AS 3 gotoAndStop Issue

From the main Time Line I have this for the actions
import flash.events.MouseEvent;
stop();
btnPricing.addEventListener(MouseEvent.MOUSE_OVER, overviewClick);
function overviewClick(event:MouseEvent):void{
    pricingMenu.gotoAndStop(2)
btnOverview is the button within the moviclip named pricingMenu
btnOverview.addEventListener(MouseEvent.CLICK, overviewClick);
function overviewClick(event:MouseEvent):void
    pricingPages.gotoAndStop(20);
pricingPages is another movie clip that I need it to go to when pressing btnOverview and I need to go to frame 20 when pressed
Now when I go to publish it I get this
Symbol 'pricingMenu', Layer 'Actions', Frame 10, Line 6    1120: Access of undefined property pricingPages.
How do I fix this?
Thanks

There is only 1 frame. Here is what the first frame looks like. If you need other screen shots let me know and I will get them for you.
Thanks for helping me BTW. I really do appreciate it.

Similar Messages

  • GotoAndStop() ISSUE [HELP]

    a simple gotoAndStop is taking up to 3 seconds to trigger.  Any ideas why that would be ?  It's driving me nuts.
    Any help is appreciated.

    I tried making something very simple.
    5 frames
    I put a different image on each frame. Each image is inside a movieclip.
    I put 5 buttons along the bottom of the screen.  Each button has a gotoAndStop mouse event to go to frames 1 to 5.
    When pressing the button.. it takes sometimes up to 5 seconds to go to the frame.
    How can I get around the lag ?
    It seems that once the frame loads once... the delay is reduced by about 50%
    This is driving me nuts

  • NetStream Video Control button issue

    The stop button plays as expected.  The play/pause button plays as expected.  The issue is when you press pause which will cause the play button to appear, then press stop.  the video automatically plays and it shouldn't. I have bolded the control button script for convenience.
    var nc:NetConnection = new NetConnection();
    nc.connect(null);
    var ns:NetStream = new NetStream(nc);
    theVideo.attachVideo(ns);
    ns.play("LOB2_0644_new.flv");
    stop_mc.onRelease = function(){
    playpause_mc.gotoAndStop("playing");
    ns.seek(0);
    ns.pause();
    playpause_mc.onRelease = function(){
    ns.pause();
      if (this._currentframe == 1)
            this.gotoAndStop("playing");
            movie_mc.play();
        else
            this.gotoAndStop("paused");
            movie_mc.stop();
        } // end else if
    } // End of the function
    var videoInterval = setInterval(videoStatus,100);
    var amountLoaded:Number;
    var duration:Number;
    ns["onMetaData"] = function(obj){
    duration = obj.duration;
    function videoStatus(){
    amountLoaded = ns.bytesLoaded / ns.bytesTotal;
    loader.loadbar._width = amountLoaded * 424;
    loader.scrub._x = ns.time / duration * 424;
    var scrubInterval;
    loader.scrub.onPress = function(){
    clearInterval(videoInterval);
    scrubInterval = setInterval(scrubit,10);
    this.startDrag(false,0,this._y,424,this._y);
    loader.scrub.onRelease = loader.scrub.onReleaseOutside = function(){
    clearInterval(scrubInterval);
    videoInterval = setInterval(videoStatus,100);
    this.stopDrag();
    function scrubit(){
    ns.seek(Math.floor((loader.scrub._x/424)*duration));
    _root.createEmptyMovieClip("vSound",_root.getNextHighestDepth());
    vSound.attachAudio(ns);
    var so:Sound = new Sound(vSound);
    so.setVolume(100);

    before executing gotoAndStop("playing") check if playpause_mc is already on the "playing" frame.   if it is, do nothing.  if it's not, execute your gotoAndStop().
    also, you probably want:
       else
    ns.play();
            this.gotoAndStop("paused");
            movie_mc.stop();
        } // end else if

  • Memory Leak with GotoAndStop()

    I am trying to track down a solution to a memory leak within an embedded video.  If I embed a video on the timeline and then run gotoAndStop or gotoAndPlay to a specific frame every time the frame changes it takes in more memory until it crashes at about 1.7GB however if I run a straight play() on the same clip the memory usage remains constant.  I have also tried System.gc() as it is an AIR App and have tried unloadAndStop() with the embeded video being loaded into a Loader and neither can reclaim any memory.
    I am looking for a a way to resolve the memory leak or another way to be able to rapidly jump to specific frames of video as far as I know this is not possible with external flvs.
    Thanks
    Dave

    video is much like a .gif file.  if you start at frame 0 and jump to frame 30 it needs to redraw what it does nt have in frame 30  which means tellign it to start at frame 30 is the same as telling it to get all information from when it last changed which might be frame 27 to complete the frame of what should display on frame 30.
    this is why its slow to play backwards.  and best to play an flv forward.
    what i would suggest if you do not need video persay, would be to use png sequences.  but if your videos are long then i suppose it would be a greater advantage to keep it compressed.
    what is the quality as well of the video and its size and your frame rate?
    You mention that you are creating a 3d view, how is that?  do you use more than 1 swf ?
    I still think this does not sound like a play head issue, since the video is already compiled.

  • About Drag and drop issue

    As title, i am a newbie to flash using ActionScript 2.0 , and currently i enounter the problem with drag and drop coding. Below is my code:
    function dragSetup(clip, targ, position) {
    clip.onPress = function() {
    startDrag(this);
    clip.x +=2;
    clip.swapDepths(clip.x);
    clip.onRelease = clip.onReleaseOutside=function () {
    stopDrag();
    if (eval(this._droptarget) == targ) {
    this.onTarget=true;
    gotoAndStop(position);
    } else {
    this.onTarget=false;
    gotoAndStop(position);
    clip.myHomeX=clip._x;
    clip.myHomeY=clip._y;
    clip.onEnterFrame = function() {
    if(this.onTarget)
              this._x-=(this._x-this.myHomeX)/5;
              this._y-=(this._y-this.myHomeY)/5;
    function dragSetup2(clip, targ, correct) {
    clip.onPress = function() {
    startDrag(this);
    clip.x +=2;
    clip.swapDepths(clip.x);
    clip.onRelease = clip.onReleaseOutside=function () {
    stopDrag();
    if (eval(this._droptarget) == targ) {
    clip._visible = false;
    this.onTarget=false;
    gotoAndStop(correct+1);
    } else {
    this.onTarget=false;
    gotoAndStop(correct);
    var frame:Number = 1;
    dragSetup2(flexibleTxt, questionBox, frame);
    dragSetup(transparentTxt, questionBox, frame);
    dragSetup(blueTxt, questionBox, frame);
    dragSetup(TIRTxt, questionBox, frame);
    dragSetup(TRTxt, questionBox, frame);
    dragSetup(ssmTxt, questionBox, frame);
    dragSetup(siliconTxt, questionBox, frame);
    dragSetup(silicaTxt, questionBox, frame);
    dragSetup(silicateTxt, questionBox, frame);
    dragSetup(infraTxt, questionBox, frame);
    dragSetup(radioTxt, questionBox, frame);
    dragSetup(lightTxt, questionBox, frame);
    dragSetup(copperTxt, questionBox, frame);
    dragSetup(gopTxt, questionBox, frame);
    dragSetup(liquidTxt, questionBox, frame);
    The scenario is , whenever correct mc was drag and drop on the target mc , it move to the next frame with new target mc(new question) , for example "questionBox2".
    By applying the code above, everything work fine but i would like that whenever i "throw" the answer mc (flexibleTxt, blueTxt etc) , i want it to slide or glide for little more distance, jz like how u throw a card in real life on a smooth surface.
    I also prefer that when draging it's "angle?" change according to the direction of draging. For example if u point ur finger on north side of a card and drag to the east, it's "angle?" will change according to the direction u drag, in this case, means east.
    I know my description seem abit complicated but i really someone can undestand and help me solve this issue.
    This is the link i reference to for the code above,but i modify it to my own preference :http://www.swinburne.edu.au/design/tutorials/P-flash/T-How-to-drag-and-drop-in-Flash/ID-37 /
    PS : can i attach my fla file in this forum? if can, why i cant found any attach button?

    I am having a similar but reverse problem: Under 10.5.2, when trying to push or pull files from my wireless MacBook Pro via my Airport Extreme base station to or from my wired G5 Power PC, files hang in mid copy then stall.
    The other way around -- working from the G5 -- I have no problem at all.
    This started with 10.5, but I'm not sure if it was .1 or .2 because I upgraded from 10.4 just recently and did the combined 10.5 updates all at once on both machines.
    Thanks

  • Issue with LoadVarNum and POST

    I am trying to set up a form using flash and PHP however the
    first issue I ran into is that when I click the submit button the
    computer opens the .php file in another window rather then going to
    the next frame and using the .php file to send me an email with the
    information.
    Below is my code. Its been forever since I have done
    actionscripting and my mind is foggy.
    on(release){
    loadVariablesNum("contact.php"),"_blank","POST");
    gotoAndStop(2)
    }

    if you want to load the variables into your _level0 swf, use:
    loadVariablesNum("contact.php",0,"POST");

  • Redraw issues when compile for Air

    This is about redraw issues which occur in Flash, when I try to compile a file in Air 2.6. The initial files were built in inDesign CS5.5, saved as a FLA, and opened in Flash CS5.5.
    I created a test file in inDesign to be used as an Air App, as I saw discussed and done on several videos on Adobe.tv. The file has 3 pages. The pages are pretty simple. Though there are some  clipping paths and animation.
    Here are the steps:
    1.
    I ported the filed to Flash, as a FLA.
    2.
    I opened the FLA in Flash, and added some more animation.
    I added simple code so the file will go from frame to frame, (what were the pages in inDesisgn), on mouse click in the frame.
    3.
    If I complie it is Flash, it works.
    4.
    If I compile it in Air, which I want to do, when it gets to the last page, it starts to have redraw-issues.
    When  the user clicks on page/frame 3, (the last page), there is AS3 code,  a gotoAndStop(), which normally  takes the user back to frame 1. But in Air, the user gets to page one,  but only sees page 3, thinking they are on page 3, as the redraw of page 1 never occurs. I tested this very  carefully, by rebuilding the whole thing and removing every element and all code and starting over piece by piece to isolate the issue.
    5.
    The  issue seems to be, if I remove all the pagespreads from inDesign, which the FLA transformed into "movieclips" in Flash, it works fine without redraw issues. If I  add any of the pagespread movieclips to a frame in the Flash file, as they were when  imported, the redraw issue occurs, but only when I compile in Air.
    Have  you heard of this before? I was wondering if there might be some  settting in Air that is conflicting with the inDesign created pages which are now movieclips in Flash. I am hoping there is something that I can do to  fix it, as I would like to continue to create the spreads in inDesign.
    I  am working on a PC in Windows Vista. I wondered if this was the issue  as well. I can share the file if you want to see it, compiled in flash,  and compiled in Air or the FLA.
    Thanks very much,
    e

    I fixed it. it was not the code. it was the use of text. This time  when exporting to an FLA from indesign, I  turned the TLF text to pixels, and now it compiles  fine. I isolated the problem by dismantling each item in the indesign  spread, and seeing when the problem occured. once I removed the type, it  had no issues. I was using hanging indents. Maybe that was the issue.  All I know is once I turned off the TLF text option, there are no  problems.It is sad to lose that feature. but at least it works, and I  would rather have my type look well formatted with hanging intents, and  correct kearning, even if i have to rasterize it first.
    geez. that was fun.

  • GoToAndStop problem in AIR but not in Flash Player 10

    Hi,
    I'm currently developing a login screen for users to acces my application.
    For the login I have 3 frames, frame 1 allows the user to view the assessor login form or the client login form. Depending on which button they select the function "gotoAndStop(frameNo)" is called with frameNo being either frame 2 for assessors login or frame 3 for clients.
    I also have a back to the home screen button which returns to frame 1 "gotoAndStop(1)".
    The issue I am having is that it returns to frame 1 but the contents from the previous frame (a movie clip) is still visible. This issue doesn't happen when running my applications in flash player 10.
    Could anyone help?
    Regards,
    Shaun

    Just ran into this issue myself. This came up while looking to see what's going on. I'm testing AIR for iOS and if I do a gotoAndStop(), the numbers all trace correctly, but it doesn't seem to actually re-render the asset on the correct frame. If I click and advance the frame, it updates and displays the correct frame.

  • AS3 Button Issue

    Hi,
    I am having a issue with my main menu buttons. My buttons are controlled by AS. Here is the code I am using for the buttons.
    //handle events for buttons...
    home.addEventListener(MouseEvent.CLICK, clickSection);
    design.addEventListener(MouseEvent.CLICK, clickSection);
    photography.addEventListener(MouseEvent.CLICK, clickSection);
    about.addEventListener(MouseEvent.CLICK, clickSection);
    contact.addEventListener(MouseEvent.CLICK, clickSection);
    company.addEventListener(MouseEvent.CLICK, clickSection);
    function clickSection (evtObj:MouseEvent) {
    //trace shows what's happening.. in the output window
    trace ("The "+evtObj.target.name+" button was clicked!")
    // go to the section clicked on...
    gotoAndStop(evtObj.target.name);
    The issue I am having is that say the user clicks on the Design button on the home page, the design button goes in to a page of company logos, the user then clicks on a companies logo to view the work that we have done for that company, a slide show of photographs opens when the user clicks on the company logo. The user click thru the photos. Here is the issue I am having. I want the user to be able to click on the main Design button to get back to the logos section, which is the start of the design section. If you are in my design section, the design button does not work, or reload the section. You have to, say, click on the contact button, then click on the design section again in order to start it over. I hope this makes sense, and that someone can help. My email is [email protected] if anyone thinks they can help.
    Thank you.

    One of the approaches can be holding references to the clicked button and frame in wich the click occured. here may be bugs in the code - this is just a concept:
    //handle events for buttons...
    home.addEventListener(MouseEvent.CLICK, clickSection);
    design.addEventListener(MouseEvent.CLICK, clickSection);
    photography.addEventListener(MouseEvent.CLICK, clickSection);
    about.addEventListener(MouseEvent.CLICK, clickSection);
    contact.addEventListener(MouseEvent.CLICK, clickSection);
    company.addEventListener(MouseEvent.CLICK, clickSection);
    // currently clicked button
    var currentClick:DisplayObject;
    // return frame
    var returnFrame:int = 0;
    function clickSection (evtObj:MouseEvent) {
         //trace shows what's happening.. in the output window
         trace ("The "+evtObj.target.name+" button was clicked!")
         // go to the section clicked on...
         if (currentClick && evtObj.currentTarget == currentClick) {
              currentClick = null;
              gotoAndStop(returnFrame);
         else {
              gotoAndStop(evtObj.currentTarget.name);
              currentClick = evtObj.currentTarget;
              returnFrame = MovieClip(this).currentFrame;

  • Load & Unload Movie Issue

    Hi Guys:
    Have 2 unable solve issues, would be much appreciated if anyone could help.
    // ISSUE 1 //
    I am experiencing an issue with Load & Unload Movie.  What happen is that I am trying to load an external SWF into a movie clip call movieContainer in my main website.  This external SWF file has timeline that perform a animation when it's loaded into the movieContainer.
    I can load and unload the movie with no problem...the issue is that after I unload the SWF and then at any point of the movie on the main website I click to load the SWF back to the stage.....the timeframe of the SWF file stay at where it get left off(when it's unloaded).  I am trying to make it play start all over again.
    I try the movieContainer.content.gotoAndPlay(1); but it doesn't do anything. Any idea how I could make this work?
    Here is my code:
    var content:Loader = new Loader();
    content.load(new URLRequest("externalSwf/content.swf"));
    loadMovieButton.addEventListener(MouseEvent.CLICK, loadMovieButtonClicked);
    function loadMovieButtonClicked(e:MouseEvent):void{
        movieContainer.addChild(content);
    // ISSUE 2 //
    In my external SWF file, I have create a loading loader at the 1st frame.  But it doesn't play all the time when I testing on the server.  It works just fine when I test locally with TEST MOVIE.  Not only it doesn't play all the time.....it suppose to play from 2nd frame of the movie after the loading is finished (I have a short animation play between frame 2 - frame 20)  Instead of playing from frame 2 to frame 20, the animation just jump straight to frame 20...which mean the user won't see the animation between frame 2 - frame 20.
    import flash.events.ProgressEvent;
    function update(e:ProgressEvent):void
    var percent:Number = Math.floor( (e.bytesLoaded*100)/e.bytesTotal );
    if(preloaderMC is MovieClip){
    preloaderMC.gotoAndStop(percent);
    //preload_txt.text = String(percent);
    if(percent == 100){
    gotoAndPlay(2);
    loaderInfo.addEventListener(ProgressEvent.PROGRESS, update);
    // Extra test for IE
    var percent:Number = Math.floor( (this.loaderInfo.bytesLoaded*100)/this.loaderInfo.bytesTotal );
    if(percent == 100){
    nextFrame();
    stop();
    Many Thanks!

    Thanks for the reply, the code I use to load the external SWF is:
    The button is within a movieClip: commercialScrollBar_mc
    The button instance name is: stackPancakeBar
    The external SWF get to load into a movieClip container call: projectDetailsContainer_mc
    var ldr:Loader = new Loader();
    ldr.load(new URLRequest("projectsCommercial/stackPancakeBar.swf"));
    commercialScrollBar_mc.stackPancakeBar.addEventListener(MouseEvent.CLICK, stackPancakeBarClicked);
    function stackPancakeBarClicked(e:MouseEvent):void{
        MovieClip(ldr.content).gotoAndPlay(1);
        projectDetailsContainer_mc.addChild(ldr);
    I was thinking does it has anything to do with the UNLOAD script I have on the external SWF file? Below are the code for removing the child.
    back_btn.addEventListener(MouseEvent.CLICK, removeProjectDetails);
    function removeProjectDetails(e:MouseEvent):void{
        this.parent.parent.removeChild(this.parent);
    Thanks Heaps, by the way, do you have any idea why the loading sequence doesn't get to play every time?  Or perhape the file size is too small?

  • Error #1010 issue

    I'm trying to finish this code for a class project, and I keep getting this "
    TypeError: Error #1010: A term is undefined and has no properties.
        at ViolaMobileGameStudentsVersion_fla::MainTimeline/gameLoop()"
    I've debugged it and it's said that the issue is at frame 86, which is
    "menuScreen.level_txt.text = String(level);"
    Here's the whole code, it's kind of long but I can't figure anything out. All the texts have their proper names.
    Any suggestions are appreciated, I have to have this turned in by saturday..
    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    import fl.transitions.TweenEvent;
    import flash.events.Event;
    import flash.events.KeyboardEvent;
    import flash.media.Sound;
    import flash.net.SharedObject;
    import flash.events.MouseEvent;
    /**************VARIABLES**************/
    var STATE_INIT_GAME:String = "STATE_INIT_GAME";
    var STATE_START_PLAYER:String = "STATE_START_PLAYER";
    var STATE_PLAY_GAME:String = "STATE_PLAY_GAME";
    var STATE_END_GAME:String = "STATE_END_GAME";
    var gameState:String;
    var player:MovieClip;
    var enemies:Array;
    var level:Number;
    var score:Number;
    var lives:Number;
    var Bullet:Array;
    //var bulletTimer:Timer = new Timer(200);  // do not add this line
    var explosions:Array;
    var spaceKey:Boolean = false;
    var rightKey:Boolean = false;
    var leftKey:Boolean = false;
    var upKey:Boolean = false;
    var downKey:Boolean = false;
    var accel:Accelerometer;
    var hiddenOptions:Boolean = true;
    /**************SETUP**************/
    gameOverScreen.visible = false;
    optionsMenu.visible = false;
    stage.addEventListener(KeyboardEvent.KEY_DOWN, watchKeys);
    stage.addEventListener(KeyboardEvent.KEY_UP, resetKey);
    stage.addEventListener(KeyboardEvent.KEY_UP, optionsKey);
    /**************INTRO SCREEN**************/
    titleScreen.play_btn.addEventListener(MouseEvent.CLICK, clickAway);
    function clickAway(event:MouseEvent):void
        moveScreenOff(titleScreen);
    //Gesture Swipe
    Multitouch.inputMode = MultitouchInputMode.GESTURE;
    titleScreen.addEventListener(TransformGestureEvent.GESTURE_SWIPE, swipeAway);
    function swipeAway(event:TransformGestureEvent):void
        //Swipe Left
        if (event.offsetX == -1)
            moveScreenOff(titleScreen);
    function moveScreenOff(screen:MovieClip):void
        var introTween = new Tween(screen,"x",Strong.easeInOut,screen.x,(screen.width)*-1,1,true);
        introTween.addEventListener(TweenEvent.MOTION_FINISH, tweenFinish);
        function tweenFinish(e:TweenEvent):void
            gameState = STATE_INIT_GAME;
            addEventListener(Event.ENTER_FRAME, gameLoop);
    we stopped here
    /**************GAME STATES**************/
    function gameLoop(e:Event):void
        menuScreen.level_txt.text = String(level);
        menuScreen.score_txt.text = String(score);
        menuScreen.lives_txt.text = String(lives);
        switch (gameState)
            case STATE_INIT_GAME :
                initGame();
                break;
            case STATE_START_PLAYER :
                startPlayer();
                break;
            case STATE_PLAY_GAME :
                playGame();
                break;
            case STATE_END_GAME :
                endGame();
                break;
    /**************STATE_INIT_GAME**************/
    function initGame():void
        player = new Player();
        enemies = new Array();
        Bullet = new Array();
        explosions = new Array();
        level = 1;
        score = 0;
        lives = 3;
        fire_btn.visible = true;
        gameState = STATE_START_PLAYER;
    /**************STATE_START_PLAYER**************/
    function startPlayer():void
        player.x = stage.stageWidth / 2;
        player.y = stage.stageHeight - player.height;
        player.cacheAsBitmap = true;
        addChild(player);
        accel = new Accelerometer();
        if (Accelerometer.isSupported)
            accel.addEventListener(AccelerometerEvent.UPDATE, accelMove);
        else
            //If there is no accelerometer support...
            addEventListener(Event.ENTER_FRAME, movePlayer);
        gameState = STATE_PLAY_GAME;
    function accelMove(event:AccelerometerEvent):void
        player.x -=  event.accelerationX * 100;
        player.y +=  event.accelerationY * 80;
        if (player.x < 0)
            player.x = 0;
        else if (player.x > (stage.stageWidth - player.width) )
            player.x = stage.stageWidth - player.width;
        if (player.y < 50)
            player.y = 50;
        else if (player.y > stage.stageHeight - player.height)
            player.y = stage.stageHeight - player.height;
        addEventListener(MouseEvent.CLICK,fire);
    function fire(evt:MouseEvent):void
        createBullet();
    function movePlayer(Evt:Event):void
        if (rightKey)
            player.x +=  10;
        else if (leftKey)
            player.x -=  10;
        if (upKey)
            player.y -=  4;
        else if (downKey)
            player.y +=  4;
        if (spaceKey)
            createBullet();
        if (player.x < 0)
            player.x = 0;
        else if (player.x > stage.stageWidth - player.width)
            player.x = stage.stageWidth - player.width;
        if (player.y < 50)
            player.y = 50;
        else if (player.y > stage.stageHeight - player.height)
            player.y = stage.stageHeight - player.height;
    function createBullet():void
        var tempBullet:MovieClip = new Bullets();
        tempBullet.x = player.x;
        tempBullet.y = player.y;
        tempBullet.cacheAsBitmap = true;
        tempBullet.speed = 15;
        addChild(tempBullet);
        Bullet.push(tempBullet);
    function moveBullet():void
        var tempBullet:MovieClip;
        for (var i=Bullet.length-1; i>=0; i--)
            tempBullet = Bullet[i];
            tempBullet.y -=  tempBullet.speed;
            if (tempBullet.y < 0)
                removeBullet(i);
        var tempExplosion:MovieClip;
        for (i=explosions.length-1; i>=0; i--)
            tempExplosion = explosions[i];
            if (tempExplosion.currentFrame >= tempExplosion.totalFrames)
                removeExplosion(i);
    /**************STATE_PLAY_GAME**************/
    function playGame():void
        makeEnemies();
        moveEnemies();
        moveBullet();
        testForEnd();
    function makeEnemies():void
        var chance:Number = Math.floor(Math.random() * 60);
        var whichEnemy:Number = Math.round(Math.random() * 2 + 1);
        if (chance <= 1 + level)
            var tempEnemy:MovieClip;
            tempEnemy = new Enemy();
            tempEnemy.gotoAndStop(whichEnemy);
            tempEnemy.speed = 3;
            tempEnemy.x = Math.round((Math.random() * 800) + 20);
            tempEnemy.cacheAsBitmap = true;
            addChild(tempEnemy);
            enemies.push(tempEnemy);
            setChildIndex(menuScreen,numChildren-1);
    function moveEnemies():void
        var tempEnemy:MovieClip;
        for (var i:int =enemies.length-1; i>=0; i--)
            tempEnemy = enemies[i];
            tempEnemy.y +=  tempEnemy.speed;
            if (tempEnemy.y > stage.stageHeight)
                removeEnemy(i);
                lives--;
            else if (tempEnemy.hitTestObject(player))
                makeExplosion(tempEnemy.x, tempEnemy.y);
                removeEnemy(i);
                lives--;
            var tempBullet:MovieClip;
            //tempEnemy = enemies[i];
            for (var j:int=Bullet.length-1; j>=0; j--)
                tempBullet = Bullet[j];
                if (tempEnemy.hitTestObject(tempBullet))
                    makeExplosion(tempEnemy.x, tempEnemy.y);
                    removeEnemy(i);
                    removeBullet(j);
                    score +=  5;
    function makeExplosion(ex:Number, ey:Number):void
        var tempExplosion:MovieClip;
        tempExplosion = new Explosion();
        tempExplosion.x = ex;
        tempExplosion.y = ey;
        addChild(tempExplosion);
        explosions.push(tempExplosion);
        //var sound:Sound = new Explode();
        //sound.play();
    function testForEnd():void
        if (score > level * 100)
            level++;
        if (lives == 0)
            gameState = STATE_END_GAME;
    function removeEnemy(idx:int)
        removeChild(enemies[idx]);
        enemies.splice(idx,1);
    function removeBullet(idx:int)
        removeChild(Bullet[idx]);
        Bullet.splice(idx,1);
    function removeExplosion(idx:int)
        removeChild(explosions[idx]);
        explosions.splice(idx,1);
    /*********** KEY PRESS ***********/
    function watchKeys(evt:KeyboardEvent):void
        if (evt.keyCode == Keyboard.SPACE)
            spaceKey = true;
        if (evt.keyCode == Keyboard.RIGHT)
            rightKey = true;
        if (evt.keyCode == Keyboard.LEFT)
            leftKey = true;
        if (evt.keyCode == Keyboard.UP)
            upKey = true;
        if (evt.keyCode == Keyboard.DOWN)
            downKey = true;
    function resetKey(evt:KeyboardEvent):void
        if (evt.keyCode == Keyboard.SPACE)
            spaceKey = false;
        if (evt.keyCode == Keyboard.RIGHT)
            rightKey = false;
        if (evt.keyCode == Keyboard.LEFT)
            leftKey = false;
        if (evt.keyCode == Keyboard.UP)
            upKey = false;
        if (evt.keyCode == Keyboard.DOWN)
            downKey = false;
    /**************END SCREEN**************/
    function endGame():void
        accel.removeEventListener(AccelerometerEvent.UPDATE, accelMove);
        removeEventListener(Event.ENTER_FRAME, gameLoop);
        stage.removeEventListener(KeyboardEvent.KEY_DOWN, watchKeys);
        stage.removeEventListener(KeyboardEvent.KEY_UP, resetKey);
        fire_btn.enabled = false;
        fire_btn.visible = false;
        removeEventListener(MouseEvent.CLICK,fire);
        removeGame();
        gameOverScreen.visible = true;
        gameOverScreen.x = 0;
        showResults();
    /**************REMOVE GAME**************/
    function removeGame():void
        for (var i:int = enemies.length-1; i >=0; i--)
            removeEnemy(i);
        for (var j:int = Bullet.length-1; j >=0; j--)
            removeBullet(j);
        for (var k:int = explosions.length-1; k >=0; k--)
            removeExplosion(k);
        removeChild(player);
    function showResults():void
        gameOverScreen.enter_btn.visible = false;
        gameOverScreen.nameField_txt.visible = false;
        var so:SharedObject = SharedObject.getLocal("alltimeHighScore");
        if (so.data.score == undefined || score > so.data.score)
            gameOverScreen.highScore_txt.text = "You made it to level " + level + " with a high score of " + score + ". \n Enter your name below.";
            gameOverScreen.enter_btn.visible = true;
            gameOverScreen.nameField_txt.visible = true;
        else
            gameOverScreen.highScore_txt.text = "Your score of " + score + " \n does not beat " + so.data.score + " \n by " + so.data.name;
        gameOverScreen.quit_btn.addEventListener(MouseEvent.CLICK, exitApp);
        gameOverScreen.enter_btn.addEventListener(MouseEvent.CLICK, clickEnter);
        function clickEnter(event:MouseEvent):void
            gameOverScreen.highScore_txt.text = "Great job, " + gameOverScreen.nameField_txt.text + "! \n You made it to level " + level + " \n with a score of " + score + "!";
            so.data.score = score;
            so.data.level = level;
            so.data.name = gameOverScreen.nameField_txt.text;
            so.flush();
            gameOverScreen.enter_btn.visible = false;
            gameOverScreen.nameField_txt.visible = false;
        //Enables the play button
        gameOverScreen.playAgain_btn.addEventListener(MouseEvent.CLICK, clickFinalAway);
        function clickFinalAway(event:MouseEvent):void
            moveScreenOff(gameOverScreen);
    /**************OPTIONS MENU**************/
    function optionsKey(event:KeyboardEvent):void
        //Options menu, use 16777234 or Keyboard.MENU
        if (event.keyCode == 16777234)
            if (hiddenOptions)
                setChildIndex(optionsMenu,numChildren-1);
                optionsMenu.visible = true;
                optionsMenu.addEventListener(MouseEvent.CLICK, exitApp);
                pauseGame();
            else
                optionsMenu.visible = false;
                optionsMenu.removeEventListener(MouseEvent.CLICK, exitApp);
                resumeGame();
            hiddenOptions = ! hiddenOptions;
    function exitApp(event:MouseEvent):void
        //NativeApplication.nativeApplication.exit(0);
    //Keep screen awake if you are using the Accelerometer etc.
    //NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;
    stage.addEventListener(Event.DEACTIVATE, Deactivate);
    function Deactivate(event:Event):void
        pauseGame();
    stage.addEventListener(Event.ACTIVATE, Activate);
    function Activate(event:Event):void
        resumeGame();
    function pauseGame():void
        //Remove any listener events, timers etc.
        if (gameState == STATE_PLAY_GAME)
            removeEventListener(Event.ENTER_FRAME, gameLoop);
            accel.removeEventListener(AccelerometerEvent.UPDATE, accelMove);
            removeEventListener(MouseEvent.CLICK,fire);
    function resumeGame():void
        //Activate any listener events, timers etc.
        if (gameState == STATE_PLAY_GAME)
            addEventListener(Event.ENTER_FRAME, gameLoop);
            accel.addEventListener(AccelerometerEvent.UPDATE, accelMove);
            addEventListener(MouseEvent.CLICK,fire);

    I don't see where menuScreen is intialized...  It's also long after this was due, hope you figured it out.

  • ComboBox onEnterFrame Issue

    Hi,
    I have created an email form in one swf that is called into
    another swf. In this form there is a comboBox that will populate a
    text field when something is selected in it. Everything works fine
    with the comboBox in it's own swf but when it's called into another
    swf the comboBox is inactive. I'm not sure but I think it may have
    to do with the onEnterFrame.... here is the code from the swf that
    contains the comboBox and email information.
    import mx.remoting.Service;
    import mx.services.Log;
    import mx.rpc.RelayResponder;
    import mx.rpc.FaultEvent;
    import mx.rpc.ResultEvent;
    import mx.remoting.PendingCall;
    import mx.remoting.RecordSet;
    import mx.remoting.DataGlue;
    onEnterFrame = function(){
    area_ta.text = area_cb.value;
    submit_btn.onRelease = function() {
    if (question1_txt.text == "") {
    gotoAndStop ("error");
    }else{
    var pc:PendingCall = myService.mailSuggestion
    (question1_txt.text, area_cb.value);
    pc.responder = new RelayResponder (this,
    "mailSuggestion_Result","mailSuggestion_Fault");
    gotoAndStop ("correct");
    var myService : Service = new Service("
    http://******flashservices/gateway",
    new Log (Log.DEBUG),
    "tap.*******.emailfunction",
    null,
    null);
    stop();

    Thanks for helping me with this by the way...
    Ok I added the listener and that worked in it's own swf, but
    same issue when I pull from the main swf. I'll try putting it in
    the main swf but I would like to keep it in the one its in.
    Picture a website and when you click on Ask The Trainer
    button that calls a swf and in this swf there will be a combobox to
    select what area you are from and a text box that you will fill in
    your question in and then click submit. That sends an email
    containing the info from the combobox and the text field. So I
    would need them all in the same swf, wouldn't I?

  • Redraw issues after FLA imported to Flash, and Compiled in Air

    I created a test file in inDesign. It has 3 pages. The pages are pretty simple. Though there are some clipping paths and animation.
    I ported the filed to Flash, as a FLA.
    I added video in Flash, and some more animation.
    I added code so the file will go from frame to frame, (what were the pages), on mouse click in the frame.
    If I complie it is Flash, it works great.
    If I compile it in Air, which I want to do, when it gets to the last page, it starts to have redraw-issues.
    When the user clicks on page 3, there is a gotoAndStop(), which normally takes the user back to page 1. But in Air, the user gets to page one, but only sees page 3, as the redraw never occurs. I tested this very carefully, by rebuilding the whole thing and removing every element.
    The issue seems to be, if I remove all the pagespreads, which are now "movieclips" in Flash, it works fine without redraw issues.
    If I add any of the pagespread movieclips to a frame, as they were when imported, the redraw issue occurs, but only when I compile in Air.
    Have you heard of this before? I was wondering if there might be some settting in Air that is conflicting with the inDesign created pages, which are now movieclips.I am hoping there is something that I can do to fix it, as I would like to continue to create the spreads in inDesign.
    I am working on a PC in Windows Vista. I wondered if this was the issue as well. I can share the file if you want to see it, compiled in flash, and compiled in Air.
    Thanks very much,
    e

    Just to update. this is relevant for inDesign users who want to port to Flash, and compile as an app in Air.
    It turned out what was causing the problem was  my use of the TLF text. Air did not like it and caused it to error and not function. I rasterized the text on export as a FLA instead, and it compiled fine. It may be my use of kearning, hanging indents, etc. I refined the text alot in inDesign, as would most designers. Maybe the samples used in testing never had hanging indents? Anyway, it works fine, as long as I rasterize. This loses the nice TLF editing function in Flash. But at least it works and the text looks good.
    Any info on this, or if anyone reproduces the error, I'd be interested in hearing.

  • Play & Pause issue in Captivate 6

    I have created an animation using Flash ( AS3) with some frames and has navigation buttons to go from one frame to another. It works fine when I play it directly. After loading the same file in Captivate 6, when the pause & play button of the Captivate 6 is clicked in the final output it loads different frames of the animation. So somehow animation’s navigation is getting controlled by Captivate 6. Is this a known issue? If I don’t click the Play or Pause the animation works well in Captivate 6 also.

    Thank you for your reply. I have just used gotoAndStop(<frame number>,<scene name>), no other functions. It is a very simple animation.

  • GotoAndStop to previous frames dont work

    Hey guys. I've been looking for an answer to my problem, but until now I just can't find anything.
    Here is the deal, I have a movie clip with several buttons and the following code:
    stop();
    btnOperadorComputador.addEventListener(MouseEvent.CLICK, btnHandler);
    btnOperadorComputador2013.addEventListener(MouseEvent.CLICK, btnHandler);
    //Call another buttons
    function btnHandler(event:MouseEvent) {
        switch (event.currentTarget.name){
            case "btnOperadorComputador2013"    : gotoAndStop(1); break;
            case "btnOperadorComputador"            : gotoAndStop(2); break;
            //etc...
            default: break;
         trace(event.currentTarget.name);
    When I run the swf, i am able to press all the buttons in order, until the end of the timeline. But, if I manage to click on a button to go to a previous frame, the click is 'ignored'. The console doesnt print anything and nothing happen.
    If someone is interested, I uploaded the file in this link: ouromoderno.com.br/sample.fla
    If anyone can help me, I would be very happy!
    PS. Sorry for my english.

    You can put all the buttons on a single layer rather than adding a new layer for each button. The important part was not to add any keyframes to that button layer or that tells Flash to "initialize" the button on that frame as if it never existed and would then no longer be attached to the button press code. You could have selected all the keyframes in the existing layer you had and just chose to remove all keyframes and you'd be fine.
    I did note your issue with the button being visible when that section was open and that could be fixed in a variety of ways. One of which is simply to drag the layer containing the buttons under the content layer. When the content is shown for any specific button in the same position as the button it will be on top and therefore cover the button anyhow.
    Glad you got it working nonetheless. You're welcome and good luck!

Maybe you are looking for

  • Wireless Printer says it is busy when trying to print wirelessly

    Hi, I just got the HP Photosmart Premium c310 printer. I am able to get on the wireless internet and go to apps that are on the printer its self. My Macbook Pro which is running on the Lion OSx connects to the printer wirelessly but anytime i try to

  • PLEASE, HELP ME IF YOU CAN!!

    hi guys I am a window 7 user , photoshop element 9 tells me "Unable to continu e because of a hardware or system error. Sorry, but this error is unrecoverable! " I would appreciate any response or help on this problem!

  • Table Name Storing date/time Data Loaded.

    Hi All, In BI I have few Info Providers to which data will be loaded frequently. Is there any table in BI which stores the information like the date and time the data was loaded to the corresponding Info Provider. Is there any table as such?? If yes

  • Button issues on LWUIT

    Hello I am working on buttons right now. My buttons were located from up to down by me. When I click down button I want to change image of my button which is selected . For instance when I go to hospital button I want to change my hospital button's s

  • I am making a book and only have 23 pages done.  I keep hitting the plus sign to add pages and no extra pages come up

    I am making a book and only have 23 pages done.  I keep hitting the plus sign to add pages and no knew pages appear.  Help