Hey,
Having a problem with basic navigation in a 'Captivate' bound project I'm trying to create.
I'm using the same methods/code I've used with other AS2 projects I�ve created in the past and tried to update it to AS3 but I keep getting errors.
The project/nav.fla -
I've two Content MCs based in the main/root timeline, that contain four sections in each and I'm trying to create a back button that will take the user from the start of the second MC to the end of the first MC, (hope that makes sense) so not to break the back button.
I've declared a var in the root:
var contentBk:Boolean = false;
Then on the back button in the second MC, I change the root contentBk var to true:
And I've used a conditional 'if' statement the in the first frame of the fist MC to move the movie to the last section of the first MC when the back button is pressed:
if (MovieClip(parent).contentBk == true)
{
gotoAndPlay("Section4");
} else {
}
This is the code I've used before AS2 and it works, but now AS3 keeps throwing up an error and I don't know why, In my head the logic is sound and this should work! Sigh.
Sorry Guys, I know this is basic AS3 stuff but any help would really be appreciated.
That has probably to do with the fact that content1 is framewise separated from the frame where your Boolean var is defined. Working with frames is not to recommend and causes all kinds of problems. To get by this problem you have several choices:
var myContentBk:Boolean = MovieClip(parent).contentBk;
btnBackCont1.addEventListener(MouseEvent.CLICK, btnBkCont1Clicked);
function btnBkCont1Clicked(event:MouseEvent):void
{
var forBack:MovieClip=event.currentTarget.parent.root as MovieClip;// main timeline
forBack.gotoAndPlay("Content");
myContentBk = true;
//forBack.contentBk = true;// is also possible
}
- The right of the People to create Flash movies shall not be infringed. -
Big thanks for taking the time to rely and for the help.
If you've got the time could you suggest an alternative to using frames?
I remember many moons ago...in my MX days using 'Scenes', but remember having issues with that also.
The application that I'm building is for 'Captivate' and is going to contain lots of embedded 3d rendered video, so the timeline could run into hundreds of frames, hence reason for trying to break up the MC's into smaller more manageable timelines.
So could you suggest a more efficient method for creating such an application?
You can probably tell It's been a while since i've used Flash.
Use classes and OOP. Start with a Document class. Use Design Patterns like the Model-View-Controller. Especially when your movie becomes big and complicated it is important to take the time in the beginning to set it up or as in your case to learn some things first. Animations can be done with AS rather using frames. Also videos should not be embedded. There are tons of tutorials out there when you need a certain effect or to learn something including the AS language reference.
Frames are going to drive you crazy. They are only good if you pure animation with characters.