View Full Version : onClipEvent HELL
j0se
June 8th, 2002, 03:13 AM
hello people
i'm having a bad time with the OnClipEvent, and was hoping you could -as always- provide the answer. i'm trying hard not to wear out my welcome card, but this one has me knocking at your door yet again!
where do i place the onClipEvent code??????
my book/the net/the cat says: on the movieclip instance.
i've tried placing the code in the actions pnel of the mc; on the mc at the main time line and in various other unspeakable places... but i always get the same error warning me that this code can only be used in movieclip instances and that my stupidity levels are reaching dangerous levels. (error: 'Symbol=stage_mc, Layer=actions, Frame=1: Line 5: Clip events are permitted only for movie clip instances
onClipEvent(enterFrame){'
i fear somebody will reply to this with:
'the code goes on the movieclip instance'...
at which point i will take up a career in knitting (i knew i shouldn't have given up the course in the first place)
thank you all
eyezberg
June 8th, 2002, 07:16 AM
When you're done with your 1st knitting project, upload the result :)
place a clip on the main timeline form your library and you should be able to attach any 'onClipEvent' you want to it!?..
select clip/actions/beginner mode: check if the event is grayed out or not, if it still doesn't work, reinstall Flash, or better, happily knit away ;)
I am not Jubba
June 8th, 2002, 07:47 AM
you have to actually put it on the movieClip. I think you maybe be putting it on a timeline, or something like that. Bring the MovieClip onto the main stage, rightclick on it, and select actions, and then put the code into the ACTIONS panel. If that doesn't work, when you create the symbol, make sure that MovieClip is selected. If that doesn't work then reinstall Flash, if that doesnt' work knit me a sweater...
j0se
June 8th, 2002, 11:55 AM
my god! is that what an OnClip event is?
*ferocious bout of blushing beginiing to spread*
gee... i don't know what to say... somebody advised me to use an onClipEvent to solve a prob, and they posted that code (onClipEvent(enterFrame){...)
which i then tried to paste in the right place... with not very nice results...
so i guess the onClip bit is there (invisible) because the mc has that type of event (like the button has the on(release)
ah...
ermm... sizes guys... what about sizes? sweaters, gloves, mittens, scarfs.. whatever you want...
heyu: anyone have the code for that nice twisty effect on woolly jumpers?
:)
thanks
eyezberg
June 8th, 2002, 04:36 PM
Are we to understand it works now?
I so, i'd like a woolen ..erm..thingy warmer, you know, like the RedHotChiliPeppers used to wear, except their mam's couldn't stand their music, so they had to use their old socks :) LOL
Seriously, you know how the onClip works now?
Scott
June 8th, 2002, 11:24 PM
any chance for some knitted swim trunks? its gettin hot here in vegas...
I am not Jubba
June 8th, 2002, 11:49 PM
how about a knitted sweat suit. My friend jumped into a swimming pool wearing 4 pairs of sweat pants, and 4 hooded sweat shirts and they got so heavy that they almost dragged him under....what a dumazz
j0se
June 9th, 2002, 04:17 PM
you chaps have boosted my confidence no end! i feel i could go into business... hey: knitting ain't so bad!!
:D
what? that flash? no, of course it doesn't work!!
:(
i hope you guys don't mind if i post a link to what i'm trying to achieve (it's just so much easier than explaining it!)
ok:
www.alt-student.co.uk/flash/hell.htm (http://www.alt-student.co.uk/flash/hell.htm)
that's my gui. all i want is a short movie called 'stage' to play each time you click a navigation button BEFORE you're taken to the coresponding screen (e.g. services, products... and so on)
if you click the little button at the top, you'll see the movieclip in question.
if you click the 'about us' button you can see the prob right away!
BTW: i cheated in the Services button: the start frame is on frame 10! but that's bad, especially if i later change the length of the short movie or get rid of it (i'll have 'screens' that take 10 seconds to load!)
my button code is:
on(release){
_root.stage.play("start");//play short movie
_root.about_us.play("start"); //play about us movie
}
('stage' is the instance name for the short movieclip)
that code runs through and you get both things happening at once.
so what i thought i could do is this:
1
services button :
on(release){
myVariable = 'services'
pass variable to short movieclip
go play the short movie
2
@end frame of short movie: goto myVariable
that way, the movieclip is always finished before the 'screen' is loaded
and that's it!
i can't seem to get the variable working and somebody suggested i put the code in the onClip event (that's how this can of worms happened)
i have a feeling that it could be done even better (?) i don't think putting the goto code at the end of the short mc is good programming (please slap me if i'm wrong). i.e. i might want the mc to play when the whole site loads, in which case, i don't want any 'screen' to load afterward, but i haven't come up with an alternative
my prob is mostly the syntax (as well as some of the logic etc) but i decided i want to do things effectively, and so i'm refusing to simply put an instance of the short movieclip in every 'screen' movie (because i just now the length will change one day and i'll have to edit every button to adjust the starting point of the content)
thanks for reading this
ilyaslamasse
June 9th, 2002, 04:48 PM
Ok, I haven't read the whole thing so maybe I'm totally out of focus but here are my 2 eurocents : let's say on the 'about us' button :
on (press) {
_root.stage.gotoAndPlay ("start" ) ;
_root.toPlay = "aboutus" ;
}
Then at the end of the stage movie clip
_root[toPlay].gotoAndPlay ("start" ) ;Does that make sense ??
pom 0]
j0se
June 10th, 2002, 08:32 AM
right - that ain't working for me but i think the movieclip is not receiving the variable:
if i load the variable at the start of the mc(toPlay: "about_us") then your code works, so obviously the value of the variable is getting lost between the button and the mc
do i have to declare the variable somewhere else (i.e. in the main time line?) all i've done is copy your code, so that the first apprearance of the variable is at the button(_root.toPlay = "about_us")
and does _root.(var_name) make it accessible to all objects?
ta!
j0se
June 10th, 2002, 08:39 AM
Thanks Pom!!!! your code was right!
i switched the lines so that the variable gets loaded before the mc is called:
on (press) {
_root.toPlay = "mc1";
_root.stage.gotoAndPlay("start");
}
and it works!!
this is astounding!
(you actually gave me the correct syntax for passing variables [x] in a different post with a slightly different question, but i was so miffed at this prob that i didn't notice it!!
so many thanks twice
*burn the jumpers, i say. no more wool!*
ilyaslamasse
June 10th, 2002, 10:07 AM
Oh... So flash gotoAndPlays and therefore doesn't send the variable ?? I didn't know that...
By the way, I'm happy that it's working for you. I hope you'll show us what you did some day.
pom 0]
j0se
June 11th, 2002, 02:25 AM
when i finish it, it will be my first flash effort, which i will post because you chaps have done most of it!
at the moment i've done 16 versions, lost track of everything, demoralised myself and ran out of inspiration (but that's another issue)
:)
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.