Copy link to clipboard
Copied
I am fast losing patience with AS3....i thought it would help me until this point.
I have a button which works when you first click it (to go to the next section). But if you wish to view the tech specs or copyright page and then go back and try and enter the resource....surprise the button does not work.
Here is the code:
entrance_btn.addEventListener(MouseEvent.CLICK, enterMe);
function enterMe(e:MouseEvent):void {
trace("yo've clicked me");
//MovieClip(this.root).nextFrame();
}
right now i have commented out the actual action and just ran a trace for testing. But clicking on the button is supposed to advance the root timeline by one frame, quite simple. All other buttons with similar coding work in the FLA except this one. I keep getting this error when i am testing:

Similar thing happens when i placed another navigation button onto the movie....AS3 just seems to have shut me out all of a sudden. Seriously making me lose faith and I really feel like resorting back to AS2 and re-coding this whole resource!
Does anyone have any clues as to what could be going on??? Is there some unspoken ettiquette about how to apply functions to buttons in AS3 that i am not aware of?
Thank you,
Copy link to clipboard
Copied
your button doesn't exist after changing frames. fix that.
Copy link to clipboard
Copied
I know i sound mentally challenged...but how do i do that? Do I need to have an instance of the button on every
frame that i tell my movie clip to go to? If you saw my FLA file you'd probably see the whole "picture".
Copy link to clipboard
Copied
Is it maybe because the frame you're on now doesn't have the button on it because you only added it to the first frame? When you do your code to add a frame, can you not add a keyframe which would then presumably add the button?
Copy link to clipboard
Copied
![]()
I am even more confused than ever. My first foray into AS3 was not meant to be this complicated....I am taking baby steps until i gain a REAL appreciation of how this beast works. I basically have little experience writing javascript (basic) and have never written in java c++, fortran or any or the other powerful OOP languages.
If this project gets complicated - i may as well go back to AS2.
Does anyone know how to attach FLA files to these posts???
Copy link to clipboard
Copied
what i don't get is when i go back to the frame with the button on it...wouldn't it be safe to assume the button regenerates its own instance again? Or maybe there is some etiquette i am not aware of within AS3? I haven't had this issue before with the movie...and suddenly now i do.
The enter button sits on the first page of the overlaying movie clip. There are two links to other areas of the timeline which display tech specs and copyright info. Once you get to these sections of the timeline, there is a back button which brings you back to the first screen with the enter button. Please see the screenshot below for a visual explanation. (click to enlarge)

As you can see within the function that is supposed to work, it tells the root or stage timeline to advance by one frame (commented out at the moment) which makes the welcome screen disappear as it is contained within a movie clip on that particular single keyframe...advancing it by one gets it off the stage and into the main movie which appears beneath it.
Now the enter button actually works the first time you press it (without going to the other linked sections)...but you come back from a section and the button appears disabled and i get some error information about the object not existing when it clearly does.
Have no idea what is going on and it would be great if the solution was a simple one. Thanks for your patience people. I just have not been able to find any real good solid support for AS3 out there yet and all of my colleagues appear to arrogant, busy or scared to go near it. Sometimes it really sucks to be a forerunner.
Copy link to clipboard
Copied
if you go to a frame where you "think" the enter button still (or again) exists and you receive that null-object error message, then delete what you think is the enter button on that frame where you see the error message, copy the enter button on the frame where the enter button works and paste it on the problem frame. retest.
Copy link to clipboard
Copied
Seems to have fixed the problem....but im quite sure this never happened with AS2 - there is obviously some principle withing the coding i am not "getting". What I did was put the enter button on every frame of the sequence and just make it invisible on the sections of the movie where the user is not supposed to see it.
So obviously my guess is that just because i have told it to go back to the original starting label - it has not initiated the button or its associated actionScript. Is there something here i should be doing with classes ? because honestly i have no idea, this is deep water for me.
Cheers
Copy link to clipboard
Copied
you just have to be more careful with as3. it more strictly enforces rules and is therefore, less forgiving.
Copy link to clipboard
Copied
Any decent books you would recommend for learning more about AS3. Not just dictionaries or bibles - one's that explain the whole theory and etiquette behind the coding and its principles. I was really fond of "from the source" series that macromedia used to produce. Something written like those books would be fantastic!
Basically i am applying AS2 theory upon AS3 code which is obviously producing some nasty results.
Copy link to clipboard
Copied
the flash help files, "programming actionscript 3.0" is well-written. once you get through that david stiller's actionscript 3.0 quick reference guide and senocular.com are good resources.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more