PDA

View Full Version : a question about (gotoAnd….)….



charmander
July 17th, 2005, 03:09 AM
Hi, I had a question about (gotoAnd….)….



<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>



If I had a movie clip called (theobj) formed by 5 frames…every frames has a label like (frame1, frame2, frame3, frame4 and frame5)



<o:p></o:p>



And from another movie clip I call this movie by tell target mode:



/theobj



And



gotoAndStop



in this if mode I want in specify case to call the (theobj) and go to a frame from 2 frame I define to choose from it as random……



<o:p></o:p>



Like if………….



gotoAndStop("the value I want to creat it to go (as random) to a 2 or 3 frames I define and not to go to any frame in the layer"………….



<o:p></o:p>



<o:p></o:p>



I think I must work with array mode that I can first difine the frames label…



<o:p></o:p>



And if the (if) operate realized. The array mode works to let the program choose from the labels I have defined….



<o:p></o:p>



If you have any ideas about this subject, tell me……



<o:p></o:p>



Thank you all………………………………………

nathan99
July 17th, 2005, 04:06 AM
huh?

TheCanadian
July 17th, 2005, 04:38 AM
ditto

mathew.er
July 17th, 2005, 07:45 AM
so you want to send this "theobj" movie clip to a random frame from one value to another? try this i.e. on a button:

on(release) {
//choose from and to values to make a range of out values
fromFrame = 2;
toFrame = 4;
//this creates a random round value from interval of (fromFrame ; toFrame)
goTo = random(toFrame-(fromFrame-1))+fromFrame;
theobj.gotoAndStop(goTo)
}
ok, i have attached an example fla with this.

charmander
July 17th, 2005, 07:49 AM
yes dear mathew...

this is a good example...but can i choose from labels not from number...(beacause i still bind at a numbers range...i want to call a frame haven't be behind the another frame i want to call)

mathew.er
July 17th, 2005, 03:45 PM
its simmilar with labels. use:
theobj.gotoAndStop("frame"+goTo)
oh, now i got it.... when you mentioned "frame1" and so on you ment some other different strings... so it will be more complicated...
you need an array. you can create it by this lines:

myArray:Array = ["firstFrame","secondFrame","label3","frame4","frame_5"]

now you are not depending on numbers because you use indexes of that array which are now from 0-4.
last thing you need to do is change a litle bit the previous code from:

theobj.gotoAndStop(goTo)
to:


theobj.gotoAndStop(myArray[goTo-1])
</pre>

charmander
July 17th, 2005, 04:48 PM
dear mathew...
i tried to add the actions you mentioned.......but it doesn't work correctlly..i may be don't understand it.....if you can creat a new file with the actions you mentioned in last reply

mathew.er
July 17th, 2005, 04:57 PM
ok, i will make a new fla. to be honest i didnt test the new lines so may be its my fault ;)
i will edit this post and attach the file in a moment