First image in the Gallery is stuck

I work with an image gallery and the first image in the transition are stuck at the bottom of the file, but the remaining images fly just in place.

I have a sneaking suspicion it may have something to do with my position somewhere or my interpolation. I added a global variable, thinking it may have something to do with the garbage collection causing my tween to stop partially, but it does not solve the problem. It's just this first image when it passes over the scene. After that, everything works perfectly. Even the transition of click.

It is part of my final project and because I have this problem, everything will finally work. Everything is built using as3, so you could copy and paste, if you wish. Except, of course, for the button of the url which is imported from the library and any text format which can be rigged with what embedded fonts and exported in the form Myriad .

var fileNameArray = new Array();
var urlArray = new Array();
var targetArray:Array = new Array();
var titleArray = new Array();
var descArray = new Array();

var i:Number;
var iTmb:Number = 0;
var imgTween:TweenLite;
var tweenDuration:Number = 0.4;

var tmbTotal:Number;
var dataXML:XML = new XML();
var photoFolder:String = "imgs/png/galleryImgs/";
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.load(new URLRequest("scripts/xml/gallery.xml"));
xmlLoader.addEventListener(Event.COMPLETE, xmlComplete);

var tmbGroup:MovieClip = new MovieClip();

tmbGroup.x = 400;
tmbGroup.y = 165;

addChild(tmbGroup);

var txtFace:Font = new Myriad();
var headingFormat:TextFormat = new TextFormat();
    headingFormat.font = txtFace.fontName;
    headingFormat.color = 0x0099cc;
    headingFormat.size = 14;
    headingFormat.align = "left";
    headingFormat.bold = true;
    
var bodyTxt:TextFormat = new TextFormat();
    bodyTxt.font = txtFace.fontName;
    bodyTxt.color = 0x333333;
    bodyTxt.size = 14;
    bodyTxt.align = "left";
    
// Text Fields
var headingTxt = new TextField();
    headingTxt.condenseWhite = true;
    headingTxt.autoSize = TextFieldAutoSize.LEFT;
    headingTxt.selectable = false;
    headingTxt.defaultTextFormat = headingFormat;
    headingTxt.wordWrap = true;
    headingTxt.width = 409;
    headingTxt.height = 21;
    headingTxt.x = 196;
    headingTxt.y = 355;

var urlTxt = new TextField();
    urlTxt.condenseWhite = true;
    urlTxt.autoSize = TextFieldAutoSize.LEFT;
    urlTxt.selectable = false;
    urlTxt.defaultTextFormat = bodyTxt;
    urlTxt.wordWrap = true;
    urlTxt.multiline = true;
    urlTxt.width = 490;
    urlTxt.height = 21;
    urlTxt.x = 196;
    urlTxt.y = 375;

var descTxt = new TextField();
    descTxt.condenseWhite = true;
    descTxt.autoSize = TextFieldAutoSize.LEFT;
    descTxt.selectable = false;
    descTxt.defaultTextFormat = bodyTxt;
    descTxt.wordWrap = true;
    descTxt.multiline = true;
    descTxt.width = 490;
    descTxt.height = 150;
    descTxt.x = 196;
    descTxt.y = 401;

var urlTxtTarget = new TextField();
    urlTxtTarget.condenseWhite = true;
    urlTxtTarget.autoSize = TextFieldAutoSize.LEFT;
    urlTxtTarget.selectable = false;
    urlTxtTarget.defaultTextFormat = bodyTxt;
    urlTxtTarget.wordWrap = true;
    urlTxtTarget.multiline = true;
    urlTxtTarget.width = 490;
    urlTxtTarget.height = 21;
    urlTxtTarget.x = 196;
    urlTxtTarget.y = 5000;



var urlBtn:URLBtn = new URLBtn();
    urlBtn.x = 196;
    urlBtn.y = 375;



addChild(headingTxt);
addChild(urlTxt);
addChild(descTxt);
addChild(urlTxtTarget);
addChild(urlBtn);


urlBtn.visible = false;

function xmlComplete(e:Event):void {
    dataXML = XML(e.target.data);
    tmbTotal = dataXML.thumbnail.length();

    for( i = 0; i < tmbTotal; i++ ) {
        fileNameArray.push( dataXML.thumbnail[i][email protected]() );
        urlArray.push( dataXML.thumbnail[i][email protected]() );
        targetArray.push( dataXML.thumbnail[i][email protected]() );
        titleArray.push( dataXML.thumbnail[i][email protected]() );
        descArray.push( dataXML.thumbnail[i][email protected]() );
    }
    generateTmbs();
}

function generateTmbs():void {
    var tmbRequest:URLRequest = new URLRequest( photoFolder + fileNameArray[iTmb] );
    var tmbLoader:Loader = new Loader();

    tmbLoader.load(tmbRequest);
    tmbLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, tmbLoaded, false, 0, true);
    iTmb++;
}

function tmbLoaded(e:Event):void {
    if( iTmb < tmbTotal ) {
        generateTmbs();
        descTxt.text = "Loading " + iTmb + " of " + tmbTotal + " gallery images.";
    }
    else {
        headingTxt.text = titleArray[0];
        descTxt.text = descArray[0];
        urlTxt.text = urlArray[0];
        urlTxtTarget.text = targetArray[0];
        
        var photoContainer:MovieClip = MovieClip( tmbGroup.getChildAt(tmbTotal-2) );
            photoContainer.addEventListener( MouseEvent.CLICK, transitionOut, false, 0, true );
    
    
        imgTween = new TweenLite(photoContainer, tweenDuration, {rotation:0,
                                            ease:Expo.easeInOut});
        
        urlBtn.visible = true;
        urlBtn.addEventListener(MouseEvent.CLICK, goto_URL, false, 0, true);
    }

    var photoBmp:Bitmap = new Bitmap();
    var photoBack:MovieClip = new MovieClip();

    photoBmp = Bitmap(e.target.content);
    photoBmp.x = - photoBmp.width * 0.5;
    photoBmp.y = - photoBmp.height * 0.5;
    photoBmp.smoothing = true;
    
    var photoBGWidth = photoBmp.width + 16;
    var photoBGHeight = photoBmp.height + 16;
    
    photoBack.addChild(photoBmp);
    photoBack.graphics.lineStyle(1, 0x999999);
    photoBack.graphics.beginFill(0xFFFFFF);
    photoBack.graphics.drawRect( - photoBGWidth * 0.5, - photoBGHeight * 0.5, photoBGWidth, photoBGHeight );
    photoBack.graphics.endFill();
    photoBack.x = 200;
    photoBack.y = 365;
    photoBack.rotation = 45;
    photoBack.name = "gallery " + tmbGroup.numChildren;
    
    
    imgTween = new TweenLite(photoBack, tweenDuration * 2, {x:Math.random() * 20 - 10,
                                        y:Math.random() * 20 - 10,
                                        rotation:Math.random() * 20 - 10,
                                        ease:Expo.easeInOut});
    
    tmbGroup.addChildAt(photoBack, 0);
}

function transitionOut(e:MouseEvent):void {
    var photoContainer:MovieClip = MovieClip(e.target);
        photoContainer.removeEventListener( MouseEvent.CLICK, transitionOut );
        
    
    
    
    
    imgTween = new TweenLite(photoContainer, tweenDuration, {x:220,
                                        y:180,
                                        rotation:45,
                                        ease:Expo.easeInOut,
                                        onComplete: transitionIn});
}

function transitionIn():void {
    var photoContainer:MovieClip = MovieClip( tmbGroup.getChildAt(tmbTotal-1) );
    var photoContainer2:MovieClip = MovieClip( tmbGroup.getChildAt(tmbTotal-2) );
    
    var slideNum:Number = parseInt( photoContainer.name.slice(8,10) ) + 1;
    if(slideNum == tmbTotal) slideNum = 0;
    
    imgTween = new TweenLite(photoContainer, tweenDuration, {x:Math.random() * 20 - 10,
                                        y:Math.random() * 20 - 10,
                                        rotation:Math.random() * 20 - 10,
                                        ease:Expo.easeInOut,
                                        onComplete: photoClick});
    
    
    imgTween = new TweenLite(photoContainer2, tweenDuration, {rotation:0,
                                        ease:Expo.easeInOut});
    
    tmbGroup.addChildAt( photoContainer, 0 );
    headingTxt.text = titleArray[slideNum];
    descTxt.text = descArray[slideNum];
    urlTxt.text = urlArray[slideNum];
    urlTxtTarget.text = targetArray[slideNum];
}

function photoClick():void {
    var photoContainer:MovieClip = MovieClip(tmbGroup.getChildAt(tmbTotal-1) );
        photoContainer.addEventListener( MouseEvent.CLICK, transitionOut, false, 0, true );
}

function goto_URL(me:MouseEvent) {
    navigateToURL(new URLRequest(urlTxt.text), urlTxtTarget.text);
}

Here is the XML

<?xml version="1.0" encoding="utf-8"?>
<thumbnails>
    <thumbnail filename="photoNumber01.jpg"
        url="http://www.barnesjewish.org" 
        target="_blank"
        title="Barnes-Jewish" 
        description="The dedicated heart transplant team members at Barnes-Jewish and Washington University focus only on patients undergoing transplant and those with congestive heart failure. Each person on the transplant team is an expert in a different area of transplantation. Together, they bring their expertise, knowledge and understanding to each patient in our program." />
        
    <thumbnail filename="photoNumber02.jpg"
        url="http://www.utsouthwestern.edu" 
        target="_blank" 
        title="UT Southwestern" 
        description="UT Southwestern Medical Center's Heart Transplant Program continues to rank among the best in the nation in survival rates for post-transplant patients." />
        
    <thumbnail filename="photoNumber03.jpg"
        url="http://www.mayoclinic.org/heart-transplant/" 
        target="_blank"
        title="Mayo Clinic" 
        description="The Mayo Clinic Heart Transplant Program encompasses heart, heart-lung and lung transplant, as well as the use of ventricular assist devices for infants, children and adults." />
        
    <thumbnail filename="photoNumber04.jpg"
        url="http://www.jeffersonhospital.org" 
        target="_blank"
        title="Jefferson Hospital" 
        description="As a heart care patient at Jefferson, a knowledgeable and skilled team of physicians, surgeons, nurse coordinators, psychologists, pharmacists, dieticians, researchers and staff with robust expertise and state-of-the-art resources will support you." />
        
    <thumbnail filename="photoNumber05.jpg"
        url="http://www.massgeneral.org" 
        target="_blank"
        title="Massachusetts General Hospital" 
        description="The Heart Transplant Program draws on state-of-the-art technology, leading-edge medical and surgical interventions and more than two decades of experience to provide patients with individualized care before and after their heart transplant." />
</thumbnails>

The problem is the following line in the section "else", possibly in conflict with other interpolation assigned to the object.  Comment that out and things should work as expected.  I suggest the conditional together after all the photoBMP/photoBack code... the logic being, the image in the process first, then proceed to process the other, not the other way around.  According to Kenneth, you should not use the same var for all tweens.

imgTween = new TweenLite (photoContainer, tweenDuration, {rotation: 0,})

:Expo.easeInOut}) ease;

Tags: Adobe Animate

Similar Questions

  • Lightroom will stop when you try to save the image to the Gallery

    Lightroom will stop when you try to save the image to the gallery. It just stops without warning. And he always seems to be synchronization?

    I have a Huawei p7 Please help!

    Hi AnnCicilie,

    Make sure that if the application is up to date.

    If this does not help, could you please share the newspapers of diagnosis by PM so that we can check more?

    Follow these steps to collect logs:

    • Open Mobile with Lightroom application
    • Click on the LR icon at the top left:

    • Press and hold the Lr icon at the top left that mentions your Adobe ID and click on generate Diagnostic log

    • Send email to yourself so that you have them on the desktop and then, share with me by PM

    Concerning

    Claes

  • How to select the image through the gallery or the camera on the blackberry torch 9800?

    Hi all

    I developed the web application. In I want to select the image through the camera on the blackberry 9800 torch or Gallery. so I need the code for when I click the button to view the two options which is 1. take a picture of the camera and 2. Take a photo from the gallery... So please me to fact... Thanks in advance...

    With Ragards,

    Marimuthu_P

    Sorry, there is no API available on the old version of WebWorks for this. You must create your own extension "file picker".

  • Unable to set the image of the gallery as a backdrop

    Hi all

    I was able to open the Gallery to choose the picture, but was not able to set the selected as a background image.

    Whenever I pick a picture, the default image will set to white.

    Here is my code, can anyone know where goes wrong?

    Thanks in advance.

    Container {
    
                background: recipeBackground.imagePaint
    
                attachedObjects: [
                    ImagePaintDefinition {
                        id: recipeBackground
                        imageSource: "asset:///images/bg.jpg"
                        repeatPattern: RepeatPattern.XY
                    }
                ]
                Container {
                    layout: DockLayout {
    
                    }
                    opacity: 1.0
                    visible: true
                    horizontalAlignment: HorizontalAlignment.Center
                    background: Color.Transparent
                    leftPadding: 0.0
                    ImageView {
                        imageSource: "asset:///images/header.jpg"
                        preferredHeight: 150.0
                        opacity: 0.9
    
                    }
                    Container {
                        verticalAlignment: VerticalAlignment.Center
                        horizontalAlignment: HorizontalAlignment.Fill
    
                        layout: StackLayout {
                            orientation: LayoutOrientation.LeftToRight
    
                        }
                        leftPadding: 200.0
                        Label {
                            text: "Testing"
                            preferredHeight: 100.0
                            verticalAlignment: VerticalAlignment.Center
                            horizontalAlignment: HorizontalAlignment.Center
                            textStyle {
                                base: SystemDefaults.TextStyles.MediumText
                                color: Color.White
                            }
                        }
                        ImageButton {
                            verticalAlignment: VerticalAlignment.Top
                            horizontalAlignment: HorizontalAlignment.Left
                            leftMargin: 150.0
                            defaultImageSource: "asset:///images/Settings.png"
    
                            onClicked:{
                                picker.open()
    
                            }
    
                        }
    
                        attachedObjects: [
                            FilePicker {
                                id: picker
                                property string selectedFile
                                title: qsTr("File Picker")
                                mode: FilePickerMode.Picker
                                type: FileType.Picture
                                viewMode: FilePickerViewMode.GridView
                                onFileSelected: {
                                    selectedFile = selectedFiles[0]
                                    recipeBackground.imageSource = selectedFiles[0]
                                }
                            }
                        ]
    
                    }
                }
    

    Well it just add the permission to access_shared bar - descriptor.xml and it works!

  • How do I loop back to the first image of the last frame?

    Hello

    I am currently working on the framework for a product Viewer.

    I have:

    a clip called "viewer_mc", which contains the images taken from different angles of the product. The actionscript code generates a script on the last frame of which returns to frame 1.

    a button instance called "autoplay_btn", which plays in the music video of whatever the current image is and stops on image 1.

    a left and right button are used to move the clip from the film frame, to give the appearance that the product is running.

    I managed to make him:

    having the clip play through both, return to section 1 and stop.

    have functions return button when held down, move the image in the clip using nextFrame and prevFrame commands. Right-click successfully continues a loop round the frame 1 and continues operation to give the impression of rotation.

    The last problem I do experience becomes the left button to act accordingly, ranging from the first frame to the last and continues to operate.

    Here are my actionscript so far:

    import flash.events.MouseEvent;

    var lastFrame:Number = viewer_mc.totalFrames;

    var thisFrame:Number = viewer_mc.currentFrame;

    var backFrame:Number = viewer_mc.currentFrame - 1;

    1. This is the part that gets to play through once before returning to the first image. I think that maybe the problem which I am facing is because of the part "viewer_mc.addFrameScript (lastFrame-1, initially)", that is even if I am now the left button, returning to this script and therefor have bounced back immediately to the first frame. However, there is no flickering on the screen that you would expect if that were the case

    Note: as this is a viewer of generic product that I can use as a template I use lastFrame etc. as opposed to the entry of the value in

    function initially () {}

    viewer_mc.gotoAndStop (1);

    }

    viewer_mc.addFrameScript (lastFrame-1, initially);

    2. it is the functionality for the autoplay_btn that will play through a rotation / return the Viewer to the initial view (front) of the product (fig. 1).

    autoplay_btn.addEventListener (MouseEvent.MOUSE_DOWN, autoplay);

    function autoplay (ev:MouseEvent): void {}

    var startFrame:Number = viewer_mc.currentFrame;

    viewer_mc.gotoAndPlay (startFrame);

    };

    3. it is the right key functionality, which once held, moves the clip to the next section via the function "rotateRight" based on the order "nextFrame. It loops back rounded up to the first image due to the 'viewer_mc.addFrameScript (lastFrame-1, initially)"script generated on the last frame of the clip you want.

    right_btn.addEventListener (MouseEvent.MOUSE_DOWN, rightDown);

    function rightDown(e:Event) {}

    stage.addEventListener (MouseEvent.MOUSE_UP, stoprightDown); Wait for the mouse upward on the stage, in the case where the finger/mouse moved out of the button accidentally when they release.

    addEventListener (Event.ENTER_FRAME, rotateRight); While the mouse is down, run the function check once each image according to the frame rate of project

    }

    function stoprightDown(e:Event):void {}

    removeEventListener (Event.ENTER_FRAME, rotateRight);  stop the execution of the function check each image now that the mouse is in place

    stage.removeEventListener (MouseEvent.MOUSE_UP, stoprightDown); remove the mouse listener to the top

    }

    function rotateRight(e:Event):void {}

    viewer_mc.nextFrame ();

    }

    4. This is the feature of the left button, which once held, moves the clip on the framework of prev function «rotateRight' based on the «prevFrame» order And that's where the rub, because while it works to get the movieclip to frame 1, it loops round to the last image and continue to operate, as you want.

    left_btn.addEventListener (MouseEvent.MOUSE_DOWN, leftDown);

    function leftDown(e:Event) {}

    stage.addEventListener (MouseEvent.MOUSE_UP, stopleftDown); Wait for the mouse upward on the stage, in the case where the finger/mouse moved out of the button accidentally when they release.

    addEventListener (Event.ENTER_FRAME, rotateLeft); While the mouse is down, run the function check once each image according to the frame rate of project

    }

    function stopleftDown(e:Event):void {}

    removeEventListener (Event.ENTER_FRAME, rotateLeft);  stop the execution of the function check each image now that the mouse is in place

    stage.removeEventListener (MouseEvent.MOUSE_UP, stopleftDown); remove the mouse listener to the top

    }

    I guess that's probably my logic for this part that's really let me down - I can make a similar function in actionscript 2, but am trying to learn actionscript 3 just to evolve with the times in some way and a little hard. Again, this is only a few days!

    function rotateLeft(e:Event):void {}

    {if(thisFrame==1)}

    gotoAndStop(viewer_mc.totalFrames-1);

    } else {}

    viewer_mc.prevFrame ();

    }

    }

    Any help you can give me would be welcome. For an example of the effect I'm trying to achieve with the auto play button etc. I recommend:

    http://www.fender.com/basses/precision-bass/American-standard-precision-bass

    Here is a link to the file that I made using your code with the change, I have indicated to play the opposite.  See if it works as expected.  If so, try to see what is different in your.  If not, tell me what to do, it does not reach.

    http://www.nedwebs.com/Flash/AS3_loop_play.fla

  • Images in the gallery appears only in the mapping

    Hello

    I created a Settings.isf file to import the FM 11 in RH10. During this process, I created a paragraph style (example of style), with a picture of model linked to a custom icon, I placed in the folder of symbols of the default folder Gallery (see image below).

    ExampleIcon_in Gallery.jpg

    After saving my settings file, when I try to import and map the relevant paragraph of the FM to this style, I don't see the icon. All other formatting I had defined are kept, except this icon.

    I place the images in the wrong place? Or do I have to change the path? Where I'm going wrong?

    Please guide.

    Anthony

    I think that Jeff is correct... you need to change your CSS in HR to get there.

    In most cases, you could modify the HTML code to conform to your current CSS, but since you link FM files, you will need to examine the HTML code generated by the binding files and edit the CSS to conform to the HTML code.

    If you change your mappings to the HR process, examine the generated HTML code and edit the CSS according to the needs.

  • SWF freezes on the first image in the browser, plays OK when opened in Flash. Number, nothing changed

    I installed a test site: [removed by the moderator at the request of the OP]

    If you click 'Show the gesture of task' a short clip should play. However, it freezes on the first image.

    If you download and run it locally in Flash, it works as expected.

    It worked for a few weeks (until I think that the last update of flash player...) nothing has changed on our end. Any help would be appreciated. Thank you

    Post edited by: Peter Spier

    Looks like a known issue with Flash Player: https://bugbase.adobe.com/index.cfm?event=bug&id=3160365

    Thanks for the help.

    EDIT: Can a moderator please remove the reference to the test file in the original post? Thank you

  • First images of the page and the writing is coming up on the second and third pages

    I have almost finished my model, but my first photo of the edit page and a writing appears on my second and third page how to reslove this problem I have attached a picture link below

    http://img138.imageshack.us/i/firstpageworkiscomingon.PNG/

    If you place a keyframe is empty in the framework after the content of your first page, then you should not see a part of content of the first page beyond that.

  • Preview image in the gallery.

    Original title:

    Photo display

    I can't view my photos in the album, it's just a box with a flower in there but when I click on the image to open it in Windows Live Photo Gallery, it loads. No pictures will load into my Gallery and I don't know why, I would like to be able to see my photos in my Gallery, so I know what I am pressing on. Please help me, it is a frustrating issue.

    Hi Lindsey,

    You can check out the following link and check if that helps.

    http://Windows.Microsoft.com/en-us/Windows7/view-and-print-picture-thumbnails

    Let us know if you have any questions.

  • way not alphabetical to sort the images in the Gallery?

    Hi guys,.

    has anyone of you found a way of sorting a gallery in any other form that alphabetically by file name? I'd love to sort the images by weight or by date added.

    Thank you.

    The only way to do this would be to create a web application with fields for the

    weight or date and use this web application as an image gallery. Then do a little

    filtering by using javascript. It would be a good candidate for an app to BC.

    There's a gallery app already out there which could be extended I guess.

  • Descriptions on large Images of the gallery appears

    Hello

    http://earthangroup.Blackroom.com.au/default.aspx?PageID=5806533 & page = 1 & A = Photogallery & pid = 18366 & Items = 12

    When you click on the pictures, the descriptions do not appear for the images.  It seems to be a different viewer to that in the instructions.

    Any help is appreciated.

    Concerning

    Paul

    Earthan,

    What we know is that they have pretty much disabled the effect lightbox BC and replaced it with fancybox.

    Problem is that, in doing so, they do not add the title attribute in a tag for each image, which is were the legends come.

    To resolve this problem, you must change the code in your scripts.js file. I created a jsfiddle page that shows the current code and what you will need to add to regain the title attr on you're a tag.

    http://jsfiddle.NET/chaddidthis/ELuMJ/

    Let me know if this does not work. I'm 99% it will of course.

    Thank you

    Chad Smith | http://bcgurus.com/Business-Catalyst-Templates for only $7

  • When I sync hollow photos Itunes It double images in the Gallery of the Iphone. How to get around this problem?

    Photos of iPhone App: I have 1000 photos in albums > camera. In pictures - momemts I have 5000 pictures where are these 1000 doubled over 3000 photos again. How to cancel this double effect? I already tried to reset

    Maybe you have iCloud library activated, so your iPhone becomes pictures of your two iCloud photo library and your Mac (via iTunes).

    To disable the iCloud photo library, on the iPhone, select settings, and then Photos & camera.  The 'switch' for iCloud library is here.

  • How can I reorder the albums of my images in the Gallery?

    I need to move photos from one album to another

    You can drag and drop a folder open to another folder located on the Navigation pane.

  • Whenever I visit the timeline, the video starts playback of the first image in the sequence.

    Is there a setting that stops that happen?

    In Edit > Preferences > general, uncheck the box play after Tiimeline, or similar syntax.

    Good luck

    Hunt

  • How to configure the graphic Styles for images in a gallery?

    Hello!

    I'm working on galleries with many images. The idea was to set up the first tile / image, and then save these settings in the graphic Styles, like for example a graphic Style "Gallery_Image_292_292_px" Panel, so I could assigns these parameters of dimensions with a single click on the other images in the gallery.

    But it seems that the graphic Style is not catch width and height of the image. I have missed something, and how can I make sure it's also includes these settings?

    Advice would be much appreciated

    G

    Graphic styles do not store the dimensions it would really limit their use. You could save your template image in the library that keeps all the settings. All you have to do is make drag an instance of the page and replace the image.

    David

Maybe you are looking for