Hello Michael - thanks for the reply - 

I guess my real question is, why isn't "onRollOver" and "onRollOut"
natively part of the Events that the Button Components can broadcast?

In the help docs, there is only 1 mentioned Event - which is "click" - 

It just seems odd, that I have to use one method of adding an Event
Listener for Click, and a totally different type of "Add Event Listener"
method for adding other types of events.

Do you know why that is?

Is it for the purpose of not reinventing the wheel, and borrowing events
that already exist in other components, and applying it to others?  I
know that all the components in Flash are reduced to their lowest common
denominators - and that they import their core functions from other core
classes - again, for the purpose of not having any redundant code & not
reinventing the wheel.

Thanks for your help on this, and to help me further understand how this
all works.

Mike :)
 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Michael
Bedar
Sent: Tuesday, March 28, 2006 2:32 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Using onRollOver and onRollOut inside a Class
File??

Whats wrong with this?

myButton.onPress=function(){
//
}

Alternatively, use delegate to call a function from the correct scope.

myButton.onPress=Delegate.create(this, myButton_Click)


On Mar 28, 2006, at 1:06 PM, Mike Anderson wrote:

> Hello All,
>
> I am getting very confused here, on how to get the "onRollOver" and 
> "onRollOut" events to be broadcasted whenever the mouse moves over a 
> Flash Component, contained within a MovieClip using a Class File.
>
> The component in this particular instance, is the Push Button.  When 
> reading the documentation, the only "events" that are mentioned is the

> "click" event.  To my knowledge, when using a Class File attached to a

> MovieClip containing a Push Button component, there is only one type 
> of syntax that can be used for adding listeners.
>
> For example:
>
>       myButton.addEventListener( "click", myButton_Click );
>
> And you usually place this statement inside of the onLoad function of 
> the MovieClip class itself.
>
> Then the function that handles the event, conforms to the method of 
> how functions must be written inside of a Class File:
>
>       private function myButton_Click( evtObj:Object ):Void
>       {
>               //code here...
>       }
>
> Since you can't use a listener object (like you would if you were 
> simply putting functions in the root of the movie itself), and then 
> have a statement of listenerObject.onRollOver = function() within a 
> Class File, I am wondering how I can force the onRollOver and 
> onRollOut events to get properly broadcasted.
>
> Please keep in mind, I am trying to keep 100% of my code inside of my 
> Class Files.  I know a simple solution could be simply highlighting 
> the actual Push Button within the MovieClip, and then directly apply 
> an "on(event)" function to temporarily accomplish my goals - but this 
> totally defeats the purpose of creating a separation between Flash App

> and Source Code.
>
> I also looked at the SimpleButton.as Class File in which the Button.as

> Class is based on.  Oddly enough, there are "onRollOver" and 
> "onRollOut"
> functions in there, but it doesn't Dispatch Events - it simply 
> activates the "highlight" option when the user rolls over the button.

> I thought that was pretty weird...  I manually edited the Class File, 
> so that a Dispatch Event of "onRollOver" and "onRollOut" would be 
> broadcasted, but still no dice...
>
> Could any of you point me in the right direction, on how to accomplish

> this using only Class Files?  Since V2 components, AS 2.0, and Class 
> Files are being pushed so hard as the preferred way of doing things, 
> it simply baffles me why these other events wouldn't be available to 
> the developer.  Sorry, but "click" just isn't doing it for me - I need

> more events out of my components.
>
> Thanks in advance,
>
> Mike
>
> _______________________________________________
> [email protected]
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training 
> http://www.figleaf.com http://training.figleaf.com

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to