Groups | Blog | Home
all groups > flash actionscript > may 2004 >

flash actionscript : go to not that simple!



Garusb
5/8/2004 5:17:29 PM
ok this thing is pissing me off. Whats going on!!!

ok I have a movie (SWF) called "projects" it is loaded in to a MC called
"Content" which resides in a SWF called "newportsite02"

Projects.swf has a preloader with this code:
stop();
var bt = _root.content.getBytesTotal();
kbt.text = Math.round(bt/1000);
_root.content.onEnterFrame = function() {
var bl = _root.content.getBytesLoaded();
var pr = bl/bt*100;
kbl.text = Math.round(bl/1000);
prl.text = Math.floor(pr)+"%";
_root.content.barprojects_mc._xscale = pr;
if (pr == 100) {
delete this.onEnterFrame;
play();
}
};

When this code = play it jumps to the next scene called "main"

now I have a 20 buttons in newportsite02.swf these should load projects.swf in
to the MC "content" and go to the respecting frame.

Each of the buttons have to check to see if projects.swf has been loaded
because I dont want to keep loading it if it is there.

Here is the code I have on the button that is not working:

on (press) {
_root.p = 1;
if (_root.p2==0) {
loadMovie("projects.swf", _root.content);
loadMovie("guide.swf", _root.guide);
_root.content.onEnterFrame = function() {
if (_root.content.pr == 100) {
_root.content.gotoAndStop("main",5);
delete this.onEnterFrame;
}
};
} else {
_root.content.gotoAndStop("main",5);
_root.content.description.gotoAndStop("main",5);
}
_root.p2 = 1;
}

any help would be great!

if there are questions let me know.



kglad
5/8/2004 8:45:28 PM
i only checked your code long enough to see you're using scenes to navigate.
that will not work because scenes only exist in the authoring environment. you
should use frame labels to designate keyframes needed for navigation and use
those labels in your scripting.
Jeckyl
5/10/2004 8:52:56 AM
[quoted text, click to view]

gotoAndStop method only takes a single argument, which is a frame number or
frame label

Even it the syntax was correct (its not), that code makes absolutely no
sense .. you are telling a clip called "Content" to go to a scene called
"main" .. say what?

AddThis Social Bookmark Button