开发者

flash: as3 fullscreen mode problem - screen stays black

开发者 https://www.devze.com 2023-03-04 15:45 出处:网络
i\'m trying to create a fullscreen slideshow with as3. My problem now is that if I click the fullscreen button too quick (--> before the image has been loaded and hasn\'t therefore been added to the s

i'm trying to create a fullscreen slideshow with as3. My problem now is that if I click the fullscreen button too quick (--> before the image has been loaded and hasn't therefore been added to the stage) the screen just stays black and nothing is working anymore (the following images aren't loading either.

Here is a demo of the problem: http://eckquarters.com/watch.php?e6243444a9200c

Here is the code:

function onFirstSlideLoaded(e:Event):void
            {
                trace("FIRST SLIDE LOADED EVENT STARTED");
                firstImage = imageLoader.getBitmap(e.currentTarget.id);
                slides.push(firstImage);
                firstSlideLoaded = true;
                currentImage.addChild(firstImage);
                mcSlideHolder.addChild(currentImage);
                //den Inhalt des Loaders zu einem Container ausgeben
                trace("FIRST SLIDE ADDED EVENT FINISHED");
            }




function showFull(e:MouseEvent):void
{
                trace("F U L L ");
                stage.scaleMode = StageScaleMode.NO_SCALE;
                var sw:Number = stage.fullScreenWidth;
                var sh:Number = stage.fullScreenHeight;
                //EventListener wenn sich Bildgröße verändert um Bildgröße zu aktualisieren;
                stage.addEventListener(Event.RESIZE, updateStage);      开发者_JAVA技巧        
                if(firstSlideLoaded)
                {       
                                    mcSlideHolder.addChild(currentImage);
                    stage.addChild(mcSlideHolder);
                    stage.addChild(fullScreenButton);
                    stage.addChild(slideButton);
                    stage.addChild(closeButton);
                    stage.addChild(saveButton);
                    stage.addChild(nextButton);
                    stage.addChild(prevButton);
                    firstSlideLoaded = false;
                    trace("child added");
                }

}

The bug has been driving me crazy for days and i'm pretty much out of ideas:) if anyone could help me out


Can't you add the event listener to your fullscreen button only after you've loaded the images?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号