Re: [Flashcoders] advantages of EventDispatcher over AsBroadcaster
Just setup your eventListeners to pass the decoupled data to your ready functions. dispatchEvent({type:eventClipShowStatus, target: this, current: currentMCNumber, total: totalMCNumber}); private function eventClipShowStatus(eventObj:Object):Void{ clipShowStatus(eventObj.current, eventObj.total); } Make sense? This preserves your function logic and adds a decoupler for all your data being passed around. You can also error check inside the event function to be sure proper data was passed before calling clipShowStatus. Hope this helps, Steve On 1/19/07, Holth, Daniel C. [EMAIL PROTECTED] wrote: After your post I spent most of this morning researching and debating converting a lot of my code to use the EventDispatcher instead of broadcastMessage. I like a lot of what it has to offer, but have a question... I have a function in one class that displays how many more movieclips the user will be viewing and it takes in two variables: currentMCNumber and totalMCNumber. Using broadcastMessage, I can pass those variables in directly. Can I do that with the eventDispatcher as well? For example, doing: this.broadcastMessage(clipShowStatus, currentMCNumber, totalMCNumber); Runs the clipShowStatus function as if I had actually done: clipShowStatus(currentMCNumber, totalMCNumber); But if I use the eventDispatcher I would need to do something like: dispatchEvent({type:clipShowStatus, target: this, current: currentMCNumber, total: totalMCNumber}); And make changes to my clipShowStatus method to take in an event object... Is there a way to use the EvenDispatcher with out needing to change all my functions to take in eventObjects and instead place the needed variables directly into the function? Thanks! Daniel Holth I.S. Programmer -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of T. Michael Keesey Sent: Thursday, January 18, 2007 8:11 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] advantages of EventDispatcher over AsBroadcaster The two are pretty much the same, except for one big thing: EventDispatcher allows you to distinguish between types of events. AsBroadcaster just says, Hey, there's been an update, while EventDispatcher gives detailed information (in an Event object) about exactly what that event was and only notifies the listeners which are listening to that type of event. Another advantage to using EventDispatcher is that EventDispatcher is heavily integrated into ActionScript 3.0, to the point that at least half the classes you'll encounter are dispatchers. Every single display object (movie clips, buttons, components, etc.) is a dispatcher, some with dozens of types of events (mouseMove, load, enterFrame, etc.). AsBroadcaster, on the other hand, is deprecated. On 1/18/07, Reuben Stanton [EMAIL PROTECTED] wrote: I have used both extensively and find that AsBroadcaster allows me to do the same thing in fewer lines of code, yet there seems to be a general preference in the flash community to use EventDispatcher. Is there any particular reason to use one or the other? ___ Flashcoders@chattyfig.figleaf.com 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 -- T. Michael Keesey Director of Technology Exopolis, Inc. 2894 Rowena Avenue Ste. B Los Angeles, California 90039 -- The Dinosauricon: http://dino.lm.com Parry Carney: http://parryandcarney.com ISPN Forum: http://www.phylonames.org/forum/ ___ Flashcoders@chattyfig.figleaf.com 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 This e-mail and its attachments are intended only for the use of the addressee(s) and may contain privileged, confidential or proprietary information. If you are not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution, displaying, copying, or use of this information is strictly prohibited. If you have received this communication in error, please inform the sender immediately and delete and destroy any record of this message. Thank you. ___ Flashcoders@chattyfig.figleaf.com 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 ___
Re: [Flashcoders] Delegating Events and AS2
I have been using this class for all my event needs. Simply import the class, then to use: EventManager.getInstance().addListener(eventDoThis, this); //adds the listener to the class ('this' is the scope) EventManager.getInstance().removeListener(eventDoThis, this); //removes the listener EventManager.getInstance().dispatch({type: eventDoThis, param:true, param2:false, param3:etc}); //sends the event with params private function eventDoThis(eventObj:Object):Void { trace(eventDoThis called); var p1:Boolean = eventObj.param; var p2:Boolean = eventObj.param2; var p3:String = eventObj.param3; } For me, this setup is nice and clean to use. Just be sure to keep it as a Singleton to prevent additional EventManagers from overriding this one. ***CODE* //EventManager.as import com.core.events.*; class com.core.events.EventManager { private var eventListeners:Object = new Object(); private static var _instance:EventManager; private function EventManager(Void){} public static function getInstance(Void):EventManager { if(_instance === undefined){ _instance = new EventManager(); } return _instance; } //dispatch broadcasts the event to all who are setup as listeners public function dispatch(eventObject) { var tmpA:Array = eventListeners[eventObject.type]; // Loop through this way to avoid problems with adding/removing listeners during the dispatch for (var i in tmpA) { tmpA[i][eventObject.type](eventObject); } } //add a listener to the queue, this will get called once a dispatch event happens that matches public function addListener(event:String, listener:Object) { if (eventListeners[event] == undefined) { eventListeners[event] = new Array(); } removeListener(event, listener); // a listener should only listen to an event once eventListeners[event].push(listener); } //remove the listener from the queue, this prevents additional rebroadcasting. public function removeListener(event:String, listener:Object) { var tmpA:Array = eventListeners[event]; var len:Number = tmpA.length; for (var i:Number = 0; ilen; i++) { if (tmpA[i] == listener) { tmpA.splice(i, 1); return; } } } } ***END CODE* I hope this helps you out, let me know if you have any problems with it or have any additional questions. Steve -Original Message- From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED] On Behalf Of Sean Scott Sent: Tuesday, September 26, 2006 2:09 PM To: Flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] Delegating Events and AS2 Hi All!, wondering if someone can point me in the right direction. I am trying to find a ASBoradcast / Event Dispatcher light model for my app. Basically i have a number of MCs that will have to either react to events being broadcast or broadcast their own. I have Essential AS2 by Colin Moock. Trying to find something i can import and maybe pass scope to it, vs have my main class extend it. I've googled, searched the archived and exausted my more talented flash developer friends. Thanks, Sean ___ Flashcoders@chattyfig.figleaf.com 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 ___ Flashcoders@chattyfig.figleaf.com 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
RE: [Flashcoders] anyone using mCom?
The components themselves are great. They are lightweight, generally easy to skin, and the API is very compatible with the v2 components that MM ships. With that said; the company that acquired the set, Metaliq, does not appear to be interested in documenting or supporting them. I have sent numerous emails/tickets trying to get better documentation, but have not received a reply yet on that issue. At one point, Grant Skinner said his people would try to get them to update the documentation, but this has not happened yet. Direct from their website you can see the last update was: September 1st, 2005 Version 1.0.124. HTH, Steve -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rich Rodecker Sent: Wednesday, June 07, 2006 12:02 PM To: Flashcoders mailing list Subject: [Flashcoders] anyone using mCom? anyone out there have any experience with using the mCom component set from Metalliq? Just looking for some feedback...performance issues, comparison with v2, wierdness, extending, etc. ___ Flashcoders@chattyfig.figleaf.com 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 ___ Flashcoders@chattyfig.figleaf.com 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
Re: [Flashcoders] setting the centerpoint of a movieclip?
http://www.darronschall.com/weblog/archives/54.cfm - Original Message - From: grimmwerks [EMAIL PROTECTED] To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com Sent: Wednesday, May 31, 2006 8:00 PM Subject: [Flashcoders] setting the centerpoint of a movieclip? Is there any way of setting like the regpoint of a movieclip to it's center on the fly without repositioning it? -- ---[ http://www.grimmwerks.com ---[ [EMAIL PROTECTED] ---[ [EMAIL PROTECTED] ___ Flashcoders@chattyfig.figleaf.com 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 ___ Flashcoders@chattyfig.figleaf.com 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
[Flashcoders] v2 Button Label width?
I have searched google, the list, MM/Adobe, help files and my new book, Advanced Components. I cannot seem to figure out how to determine the width of the Label embedded into the v2 Button component. I will be loading many different languages via Unicode into the label and will not know the exact size to set until I have fed the text into it. In looping through its properties I have determined the Label is stored in labelPath. The other option I am trying to avoid is rendering an identical string into an invisible label component to determine its size. The only option I see right now, is using a non-monospaced font. Any help would be appreciated. Thanks, Steve ___ Flashcoders@chattyfig.figleaf.com 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
RE: [Flashcoders] v2 Button Label width?
Setting sizes is not the issue. I need access to the size of the label after running autoSize = left and adding text to the label. I am putting in unknown text into each button and will need to resize them according to the text (Unicode) length. This is mandatory since these buttons are part of a application UI that sizes according to the nationality's current language. Using _width always returns the same result, no matter what size it is. textWidth returns undefined. Thanks, Steve -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of jim Sent: Thursday, March 02, 2006 3:12 PM To: 'Flashcoders mailing list' Subject: RE: [Flashcoders] v2 Button Label width? You set the width of the button using myButton.setSize(width, height); and im not sure but I think if you have a reference to the label text field you can use label._width = label.textWidth; Hope this helped. Jim -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Steve Polk Sent: 02 March 2006 19:02 To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] v2 Button Label width? I have searched google, the list, MM/Adobe, help files and my new book, Advanced Components. I cannot seem to figure out how to determine the width of the Label embedded into the v2 Button component. I will be loading many different languages via Unicode into the label and will not know the exact size to set until I have fed the text into it. In looping through its properties I have determined the Label is stored in labelPath. The other option I am trying to avoid is rendering an identical string into an invisible label component to determine its size. The only option I see right now, is using a non-monospaced font. Any help would be appreciated. Thanks, Steve ___ Flashcoders@chattyfig.figleaf.com 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 ___ Flashcoders@chattyfig.figleaf.com 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 ___ Flashcoders@chattyfig.figleaf.com 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
RE: [Flashcoders][Kinda OT] Re: What does this PATENT mean??
Tiny URL for everyone http://tinyurl.com/j3o3f ...and more info here. http://osflash.org/balthaser_patent_prior_art_discovery Steve ___ Flashcoders@chattyfig.figleaf.com 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