PDA

View Full Version : how can i make a button, that first finishes x frames and...



Cursed_Soul
December 18th, 2003, 11:33 AM
Hiya, flash-N00b & new here,

and i got a question,
ive looked trough the action scripts, and trough the entire 1200 page Flash handbook, but i couldnt find this one thing, wich i need really bad, im sure its scriptable, but i havent script one thing, besides some poor html.

what i want to know is, how can i make a button, that first finishes XX frames, and then goes to a sertain frame somewhere else on the timeline.



i hope someone can help me out, gotta finish this tomorrow for a schoolproject, and the teach doesnt even know what 'action scripting is' lol.

thnx in advance :)=)

e.s.x.s
December 18th, 2003, 12:41 PM
first, give a label to the frame that you want to play first:
ex. "YourFirstFrameToPlay"...
than
add the follwing code to your button:

on(release){
gotoAndPlay("YourFirstFrameToPlay");
}

After that , add your last frame :
gotoAndPlay(373);

That's what i understood ;)

i hope it will help u...

Cursed_Soul
December 19th, 2003, 04:16 AM
thnx for the advice, but the problem is,
there are multiple buttons, so how can i be sure, they all go to the right place on the timeline?

so, it isnt possible to just add a 'goto' to the last frame in the animation, becouse it would always direct it back to the same '373'

something like:


on(release)play until/if reached frame 'x'
{gotoAndPlay frame '373' (or any other number)
}

lol, i wish i took that coding class :(

Voetsjoeba
December 19th, 2003, 04:37 AM
yourbutton.onRelease = yourotherbutton.onRelease = anotherbutton.onRelease = function(){
play();
onEnterFrame = function(){
if(this._currentframe == 306){
delete this.onEnterFrame
gotoAndPlay(373);
}
}
}


Something along those lines those should do it. I can't test it out because I haven't got Flash here, but it should work. Place this code on the timeline your buttons are in, where the instance names of your buttons are 'yourbutton', 'yourotherbutton' and 'anotherbutton' in this example. You can change these to your button instance names :)

Cursed_Soul
December 19th, 2003, 06:12 PM
dude thnx, ill try it out in the morning :)

Cursed_Soul
December 20th, 2003, 07:21 AM
Another question, (yes im curious) about that script you made,
if i got multiple buttons, all directing to another place on the timeline, i should re-add the code with the propper button names right?


btw im uploading that flash animation, (i hate chello, 5kb upload :( )

its around 12.5 mb, i get a 150 to 200kb/s download so it shouldnt be that long a dl.

i didnt add the buttons yet, and got some probs with the code, flash tells me it wasnt 100% correct or something,
anyways take a look, its for a schoolproject, we had to make a point of information for a festival like ozz-fest.

i created dampkring (dampen = a dutch word for smoking weed)
(and dampkring = dutch for atmosphere)
i don smoke (a lot) myself, but i liked the idea.

link to the flash anim: http://vladderbeest.com/tempy/intro2.zip


and heres some other stuff that also had to do with the project.
pic1 (http://www.vladderbeest.com/school/TenV/waterpijp/Image9.jpg)
pic2 (http://www.vladderbeest.com/school/TenV/waterpijp/Image92.jpg)
pic3 (http://www.vladderbeest.com/school/TenV/waterpijp/flyer.jpg)
small 1.5 mb 'bong' introduction mov (http://www.vladderbeest.com/school/TenV/waterpijp/damp.avi)

dunno why im showing this stuff lol, but at least i can say to myself ive put some time in this crap :p

Voetsjoeba
December 21st, 2003, 06:37 AM
Dutch ? Ik spreek Vlaams ;)

Yes, the script will become something like this:



yourbutton.onRelease = function(){
play();
onEnterFrame = function(){
if(this._currentframe == 306){
delete this.onEnterFrame
gotoAndPlay(373);
}
}
}
yourotherbutton.onRelease = function(){
play();
onEnterFrame = function(){
if(this._currentframe == 370){
delete this.onEnterFrame
gotoAndPlay(373);
}
}
}
anotherbutton.onRelease = function(){
play();
onEnterFrame = function(){
if(this._currentframe == 250){
delete this.onEnterFrame
gotoAndPlay(373);
}
}
}


306, 370 en 250 zijn maar voorbeeldgetallen hè. Dan zou da moeten werken. Enfin, als ik u toch goed begrepen heb.