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

flash actionscript : Custom Behavior , Plz Help.


DoubleX
4/30/2004 10:14:56 PM
Hi guys,

Im trying to build a custom behavior that will go onto a deisred movie clip so
that i can easily build game enviroments. Basically i have a script which
defines a collision object "bumper" for a pinball game that would go onto every
"bumper" in the game. I want to be able to draw a bumper, convert into a movie
clip,and give it the script it needs in an onClipEvent(load){} tag. (go to
behaviors, find my pinball bumper collision behavior and apply it to the movie
clip). It is written in a way that it figures out all the necessary constants,
dimensions, etc, on load.

The problem is that when i make a custom behavior, it automatically gets cast
into a on(press) { } handler and i want to know if there is a variable i set
or something that will tell it to be cast or set into the onClipEvent handler
instead?

thanks in advance,

Nino
elemental .std
5/1/2004 6:43:03 PM
I think that you have to use Listeners to determine specific behavior on
different events.
See this site it will help you:
http://proto.layer51.com
See ASBroadcaster and MovieClip or what do you think can help!

Best Regards
Ivo
DoubleX
5/2/2004 10:30:55 PM
I looked at the site but am not sure if it would help. But anyway, the code
that specifies which handler to use is not included (as far as i can see) in
the xml file that is the behavior. It includes only the code that is placed
into the on(press){} handler automatically. For example if there is a behavior
called Movie Clip > Blah and the xml file for it has the following script
//blah blah then when you apply that behavior to a movie clip in flash, the
action script of the button is as follows on(press){ //blah blah }.

I searche google for custom behavior creation in flash and even the XML to UI
stuff but with no luck. Most of the hits i get are in relation to Directors
behaviors and i need flash behaviors. If anyone has any good resources id
apprechieate it greatly if they would share.

Thanks in advance!

P.S Thanks for you attempt though elemental, that site is a good rescource!
DoubleX
5/3/2004 6:42:03 PM
DoubleX
5/6/2004 7:12:31 PM
ok figured it out in case anyone else will be looking for making their own
custom behaviors.

To get flash not to include an automatic handler such as the on(press){}
handler when adding a your custom behavior to a movie clip / button, all you
have to do is add events = "custom" into the <behavior_definition > section of
the xml. When you do this the script that you wrote does not get cast into any
handler, so you can just add it to the script in the XML file itself.

Hope the info helps somone.

Later guys.
AddThis Social Bookmark Button