Re: [Flashcoders] Some feedback on a coding design question
Thank you for the reply. I will take a look at the state Pattern. Reading your post, I does look a bit like what I proposed. In the state pattern, I would probably create the layout and the types of buttonsets for the panel create in a object. The state of the panel then determines wich state to load and display using composition. Did I understand your comment correctly? Jiri Raymond Simmons wrote: Jiri, Sounds like the state pattern would be helpful here. Define a class for each state of the application. Each class will contain methods for actions the user can take in that state, like selectListItem. When the user takes the given action (ex., selecting a list item), the associated function in the current state is called, and the correct actions are performed. Once those actions are performed, move the application to the new state. Essentially the current state class decides what actions to take in response to user interaction with the application. Thanks, Raymond Simmons - Original Message - From: Jiri Heitlager [EMAIL PROTECTED] To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Tuesday, April 01, 2008 6:03 AM Subject: [Flashcoders] Some feedback on a coding design question Hello List, I am currently building an application that uses panels. The Panels implement a Composite Pattern. The panel holds instances of panelButtonSets class. The panel displays certain sets based on a selected item in the client code. Now my question is, how do I get around a lot of if statements in the panel like so: if(clientcode.selecteditem.type == 1){ panel.addSet(position_panel) panel.addSet(rotation_panel) panel.addSet(edit_panel) }else if(clientcode.selecteditem.type == 2){ //different sets of button sets } etc... One solution I am thinking about is the following, but I would like to get some feedback on this approach. BasicButtonSet() { addSets(new panelButtonSets(position_panel)) addSets(new panelButtonSets(rotation_panel)) } ColorButtonSet() extends BasicButtonSet { addSets(new panelButtonSets(color_panel)) addSets(new panelButtonSets(brightness_panel)) } var basicSet:ButtonSet = new BasicButtonSet(); var colorSet:ButtonSet = new ColorButtonSet(); Then the selected item holds a reference to a certain set that can be loaded into the panel. var set = selectItem.GetButtonSet(); Panel.loadSetObject(set ) { for every set in the parameter set, call its render method and place it at the right position }; The thing in this solution is that every set is allready instantiated and therefore is probably a quit expensive solution? Jiri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Multiple SWFs (50) in one html page dramaticly increase memory ?
2008/4/1, Bob Wohl [EMAIL PROTECTED]: Are you saying that you are loading 50 images into 1 swf? OR 50 images into 50 swfs and loading those into 1 swf? OR 50 swfs embeded into a browser? We have the same swf embed 50 time in a php page Each of them load a different image. Thanks -- Benoît Milgram / Flapflap http://www.kilooctet.net I'm also a music mashup / bootlegs producer : http://www.djgaston.net ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] An error I cant iron out...
It's hard to guess at this without seeing the code. Typically, this happens when you're trying to instantiate something that isn't a class or is a circular or conflicting reference. Something like var myJunk:NotAClass = new NotAClass(); or var mc:MovieClip = new MovieClip(); mc = new IsAClass(); These are off the top of my head, and might result in different TypeError or ReferneceError, but it wouldn't hurt to try to look for these examples. Rich http://www.LearningActionScript3.com On 4/1/08 2:40 PM, Patrick Jakub Jankun wrote: I have a issue with an error I cant get rid off: TypeError: Error #1007: Instantiation attempted on a non-constructor. Strange thing is, it occurs only when I try to compile with Flash IDE as Document class, It¹s not there when I compile it through Linux free command line compiler :( can someone Explain me for what should I look? Because the Error messages in Flash ide are quite hmm.. Mystic to me (at this time, im like 3 months into AS3) ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 MouseEvent target?
so how does it work internally for displayObjects? Can a developer emulate this behaviours somehow?(cant imagine it since target and currentTarget are readonly) On Tue, Apr 1, 2008 at 10:01 PM, Merrill, Jason [EMAIL PROTECTED] wrote: Well, you still haven't convinced me it isn't kludy, but no bother your perspective - my perspective - both different, doesn't matter in the end. :) Jason Merrill Bank of America GTO and Risk LLD Solutions Design Development eTools Multimedia Bank of America Flash Platform Developer Community Are you a Bank of America associate interested in innovative learning ideas and technologies? Check out our internal GTO Innovative Learning Blog subscribe. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Steven Sacks Sent: Tuesday, April 01, 2008 3:05 PM To: Flash Coders List Subject: Re: [Flashcoders] AS3 MouseEvent target? Extending DisplayObject to access some of its native functionality (e.g. event bubbling) seems fine to me, especially if you look at it from the perspective of EventDispatcher has events and DisplayObject extends EventDispatcher and adds bubbling functionality. If you need bubbling, extend the class that provides that. The whole non-visual argument is a bit of a red herring considering we're using Flash and, until recently, all Actionscript was inside of or attached to a display object (MovieClip). Technically, it still is. ;) Flash is a visual tool, and I maximize my productivity by leveraging it fully. Flash has all kinds of great Flash-centric features and you can definitely use them to your advantage. It's not hacking to use the API given to you. :) ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- M.A. van't Kruis http://www.malatze.nl/ ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Multiple SWFs (50) in one html page dramaticly increase memory ?
Is this happening on Firefox??? Have you tried running on a couple of other browsers to compare? Have you tried showing 25 SWF's to see if memory usage is approx half? Flap Flap wrote: 2008/4/1, Bob Wohl [EMAIL PROTECTED]: Are you saying that you are loading 50 images into 1 swf? OR 50 images into 50 swfs and loading those into 1 swf? OR 50 swfs embeded into a browser? We have the same swf embed 50 time in a php page Each of them load a different image. Thanks ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Glen Pike 01736 759321 www.glenpike.co.uk http://www.glenpike.co.uk ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Access
Hello, I'm having some trouble with AS3, basically if I create a movieclip using the Flash IDE and give it an instance name of mc_one, I'm unsure how to access it from an external actionscript class. Currently on the root timeline I have... var _mainClass:mainClass = new mainClass(); Which instantiates the mainClass and within the class I need to access mc_one, but obviously _root.mc_one will no longer work. I have tried this: /* ... */ public class mainClass { public var mc_one:MovieClip; public function mainClass() { trace(mc_one); // Outputs null } } The trouble is this solution does not work, it outputs null rather than [Object MovieClip] Help please! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Multiple SWFs (50) in one html page dramaticly increase memory ?
To me, having 50 Flash Player instances running concurrently does not sound like the best solution. Can it be just one SWF with 50 display objects instead? Kenneth Kawamoto http://www.materiaprima.co.uk/ Flap Flap wrote: 2008/4/1, Bob Wohl [EMAIL PROTECTED]: Are you saying that you are loading 50 images into 1 swf? OR 50 images into 50 swfs and loading those into 1 swf? OR 50 swfs embeded into a browser? We have the same swf embed 50 time in a php page Each of them load a different image. Thanks ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Access
Why don't you set your MainClass as document class? Kenneth Kawamoto http://www.materiaprima.co.uk/ Stuart (FunkDaWeb) wrote: Hello, I'm having some trouble with AS3, basically if I create a movieclip using the Flash IDE and give it an instance name of mc_one, I'm unsure how to access it from an external actionscript class. Currently on the root timeline I have... var _mainClass:mainClass = new mainClass(); Which instantiates the mainClass and within the class I need to access mc_one, but obviously _root.mc_one will no longer work. I have tried this: /* ... */ public class mainClass { public var mc_one:MovieClip; public function mainClass() { trace(mc_one); // Outputs null } } The trouble is this solution does not work, it outputs null rather than [Object MovieClip] Help please! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Access
Hi, Try tracing in the onLoad function: public class mainClass { public var mc_one:MovieClip; public function mainClass() { trace(mc_one); // Outputs null } private function onLoad():void { trace(mc_one); } } Glen Stuart (FunkDaWeb) wrote: Hello, I'm having some trouble with AS3, basically if I create a movieclip using the Flash IDE and give it an instance name of mc_one, I'm unsure how to access it from an external actionscript class. Currently on the root timeline I have... var _mainClass:mainClass = new mainClass(); Which instantiates the mainClass and within the class I need to access mc_one, but obviously _root.mc_one will no longer work. I have tried this: /* ... */ public class mainClass { public var mc_one:MovieClip; public function mainClass() { trace(mc_one); // Outputs null } } The trouble is this solution does not work, it outputs null rather than [Object MovieClip] Help please! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Glen Pike 01736 759321 www.glenpike.co.uk http://www.glenpike.co.uk ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Access
Hi tried this but didn't work! here is my code in its most simple form... package { import flash.display.MovieClip; public class mainClass extends MovieClip { // Instantiate our classes public var banner:imageLib = new imageLib(); public function mainClass() { banner.loadImage(banners/banner1.jpg, bannerArea); } } } Now the problem is bannerArea is undefined even though its on the root timeline and we have no way of directly accessing it from within the class now _root is no longer in use! SM ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Access
have you tried without the line public var mc_one:MovieClip;? it's my understanding that instantiating it by physically dragging it out of the library and giving it an instance name is the declaration - the way you're doing it would give a local variable the name with no value, hence mc_one = null a On 2 Apr 2008, at 11:53, Stuart ((FunkDaWeb)) wrote: Hello, I'm having some trouble with AS3, basically if I create a movieclip using the Flash IDE and give it an instance name of mc_one, I'm unsure how to access it from an external actionscript class. Currently on the root timeline I have... var _mainClass:mainClass = new mainClass(); Which instantiates the mainClass and within the class I need to access mc_one, but obviously _root.mc_one will no longer work. I have tried this: /* ... */ public class mainClass { public var mc_one:MovieClip; public function mainClass() { trace(mc_one); // Outputs null } } The trouble is this solution does not work, it outputs null rather than [Object MovieClip] Help please! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Access
You may have to wait until your MovieClip is initialised / on the stage before you do things with child clips. http://www.senocular.com/pub/kirupa/as3tips_p6.html There is a tip in there about the DocumentClass and listening for the ADDED event. There is also an ADDED_TO_STAGE event for later versions of FP9. This is similar to the onLoad / onClipEvent(load) from olden days - there were sometimes problems accessing child clips because they had not been loaded yet. Stuart (FunkDaWeb) wrote: Hi tried this but didn't work! here is my code in its most simple form... package { import flash.display.MovieClip; public class mainClass extends MovieClip { // Instantiate our classes public var banner:imageLib = new imageLib(); public function mainClass() { banner.loadImage(banners/banner1.jpg, bannerArea); } } } Now the problem is bannerArea is undefined even though its on the root timeline and we have no way of directly accessing it from within the class now _root is no longer in use! SM ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Glen Pike 01736 759321 www.glenpike.co.uk http://www.glenpike.co.uk ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 MouseEvent target?
which is mouseChildren = false. In my humble opinion I do not think this is what he needs. He should not be referencing target, but instead he should reference currentTarget. If you are adding a listener, the handlers e.currentTarget will point to the object that you added the listener to, e.target is the object that initiated the event (event bubbling). So in a general way, where you in AS2 were using e.target you should now use e.currentTarget. You only use e.target if you want to reference the displayObject that initiated the event. Greetz Erik On 3/31/08, Steven Sacks [EMAIL PROTECTED] wrote: IMO, explaining Event Bubbling as the reason the TextField is the target is complicating the immediate solution he needs, which is mouseChildren = false. Yes, it's Event Bubbling that's causing the target to be the TextField. To understand Event Bubbling, read about it in the docs, or better yet, in a book (like Moock's). But, then you MUST do it yourself to learn how it works. If you don't play with it yourself, you will never get it no matter how much somebody explains it to you. I'm fully convinced of that. You gotta mess around with it to fully understand why it's so amazingly awesome. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 MouseEvent target?
This behaviour can not emulated precisely because there is no way for us to set the target and currentTarget properties. This is done by internal EventDispatcher code. The EventDispatcher code works something like this: - check if the target property of the event has been set, if not set it - set the currentTarget property - check if the event has the bubbles property set to true - check if the class is a DisplayObject - check if the parent property is set - clone the event and dispatch it at the parent and repeat the above steps Greetz Erik On 4/2/08, Meinte van't Kruis [EMAIL PROTECTED] wrote: so how does it work internally for displayObjects? Can a developer emulate this behaviours somehow?(cant imagine it since target and currentTarget are readonly) ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 MouseEvent target?
So in general, where you in AS2 were using e.target you should now use e.currentTarget. +1 ;-) Must read: Event propagation http://livedocs.adobe.com/flex/3/html/events_08.html regards, Muzak - Original Message - From: EECOLOR [EMAIL PROTECTED] To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wednesday, April 02, 2008 2:22 PM Subject: Re: [Flashcoders] AS3 MouseEvent target? which is mouseChildren = false. In my humble opinion I do not think this is what he needs. He should not be referencing target, but instead he should reference currentTarget. If you are adding a listener, the handlers e.currentTarget will point to the object that you added the listener to, e.target is the object that initiated the event (event bubbling). So in a general way, where you in AS2 were using e.target you should now use e.currentTarget. You only use e.target if you want to reference the displayObject that initiated the event. Greetz Erik ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] some dying logic ...
*if (this.basicNews != null) { this.basicNews.removeEventListener(RepeaterEvent.CLICK, this.onNewsClicked); this.removeChild(this.basicNews); this.basicNews.die(); this.basicNews = null; }* In the above code I do not see why you would need any more then the following lines: *basicNews = null; removeChild(basicNews);* All references to basicNews are now removed and it is (along with its children) marked for garbage collection. Calling the other extra methods seems a waste of CPU. Greetz Erik On 4/1/08, Cedric Muller [EMAIL PROTECTED] wrote: Hello, I did develop a global process, in which my customized objects do have a 'die' method which is called in the end of an object's life in order to clean *everything* (like removing internal movieclips, sprites, listeners, timers, ..) this is what I came up with: the following block code is part of MyWhateverObject die method: // basicNews is some basic Repeater if (this.basicNews != null) { this.basicNews.removeEventListener(RepeaterEvent.CLICK, this.onNewsClicked); this.removeChild(this.basicNews); this.basicNews.die(); this.basicNews = null; } my question is the following: when would you call the basicNews.die() method ? BEFORE or AFTER the 'this.removeChild(this.basicNews)' ? tia, Cedric ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] some dying logic ...
granted that the eventListener was added with a weak reference On Wed, Apr 2, 2008 at 3:35 PM, EECOLOR [EMAIL PROTECTED] wrote: *if (this.basicNews != null) { this.basicNews.removeEventListener(RepeaterEvent.CLICK, this.onNewsClicked); this.removeChild(this.basicNews); this.basicNews.die(); this.basicNews = null; }* In the above code I do not see why you would need any more then the following lines: *basicNews = null; removeChild(basicNews);* All references to basicNews are now removed and it is (along with its children) marked for garbage collection. Calling the other extra methods seems a waste of CPU. Greetz Erik On 4/1/08, Cedric Muller [EMAIL PROTECTED] wrote: Hello, I did develop a global process, in which my customized objects do have a 'die' method which is called in the end of an object's life in order to clean *everything* (like removing internal movieclips, sprites, listeners, timers, ..) this is what I came up with: the following block code is part of MyWhateverObject die method: // basicNews is some basic Repeater if (this.basicNews != null) { this.basicNews.removeEventListener(RepeaterEvent.CLICK, this.onNewsClicked); this.removeChild(this.basicNews); this.basicNews.die(); this.basicNews = null; } my question is the following: when would you call the basicNews.die() method ? BEFORE or AFTER the 'this.removeChild(this.basicNews)' ? tia, Cedric ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- M.A. van't Kruis http://www.malatze.nl/ ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] how to check if child exists
hmmm - i'm a little stuck on this i'm trying to create a pop-up (will tween but i want to get it working first) but i want it to kill any previous one that's up - how would i go about this please? here's my current code: CODE private function createEventList(pbList_xl:XMLList):void { if (this.contains(eventList)) removeChild(eventList); // remove previous eventList if it's available - this is the bit that needs fixing var listLength:int = pbList_xl.length(); var listentryHeight:int = 15; var listHeight:int = listLength * listentryHeight; var listWidth:int = 50; var mousePoint:Point = new Point(root.mouseX, root.mouseY); // will tween from this point to a central point on the stage var eventList:Sprite = new Sprite(); eventList.graphics.beginFill(commonGrey, 1); eventList.graphics.drawRoundRect(0, 0, listWidth, listHeight, 10); eventList.x = mousePoint.x; eventList.y = mousePoint.y; addChild(eventList); } /CODE hope you can help a Allandt Bik-Elliott thefieldcomic.com e [EMAIL PROTECTED] ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] how to check if child exists
Place outside of the function - private var eventList:Sprite; Kenneth Kawamoto http://www.materiaprima.co.uk/ Allandt Bik-Elliott (Receptacle) wrote: hmmm - i'm a little stuck on this i'm trying to create a pop-up (will tween but i want to get it working first) but i want it to kill any previous one that's up - how would i go about this please? here's my current code: CODE private function createEventList(pbList_xl:XMLList):void { if (this.contains(eventList)) removeChild(eventList); // remove previous eventList if it's available - this is the bit that needs fixing var listLength:int = pbList_xl.length(); var listentryHeight:int = 15; var listHeight:int = listLength * listentryHeight; var listWidth:int= 50; var mousePoint:Point= new Point(root.mouseX, root.mouseY); // will tween from this point to a central point on the stage var eventList:Sprite = new Sprite(); eventList.graphics.beginFill(commonGrey, 1); eventList.graphics.drawRoundRect(0, 0, listWidth, listHeight, 10); eventList.x = mousePoint.x; eventList.y = mousePoint.y; addChild(eventList); } /CODE hope you can help a Allandt Bik-Elliott thefieldcomic.com e [EMAIL PROTECTED] ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] some dying logic ...
this is how the eventListener is added: this.basicNews.addEventListener(RepeaterEvent.CLICK, this.onNewsClicked, false, 0, true); granted that the eventListener was added with a weak reference On Wed, Apr 2, 2008 at 3:35 PM, EECOLOR [EMAIL PROTECTED] wrote: *if (this.basicNews != null) { this.basicNews.removeEventListener(RepeaterEvent.CLICK, this.onNewsClicked); this.removeChild(this.basicNews); this.basicNews.die(); this.basicNews = null; }* In the above code I do not see why you would need any more then the following lines: *basicNews = null; removeChild(basicNews);* All references to basicNews are now removed and it is (along with its children) marked for garbage collection. Calling the other extra methods seems a waste of CPU. Greetz Erik On 4/1/08, Cedric Muller [EMAIL PROTECTED] wrote: Hello, I did develop a global process, in which my customized objects do have a 'die' method which is called in the end of an object's life in order to clean *everything* (like removing internal movieclips, sprites, listeners, timers, ..) this is what I came up with: the following block code is part of MyWhateverObject die method: // basicNews is some basic Repeater if (this.basicNews != null) { this.basicNews.removeEventListener(RepeaterEvent.CLICK, this.onNewsClicked); this.removeChild(this.basicNews); this.basicNews.die(); this.basicNews = null; } my question is the following: when would you call the basicNews.die() method ? BEFORE or AFTER the 'this.removeChild(this.basicNews)' ? tia, Cedric ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] how to check if child exists
that's actually helped me implement a movieActive variable so i've decided to go down that route instead - thanks for the input On 2 Apr 2008, at 16:35, Kenneth Kawamoto wrote: Place outside of the function - private var eventList:Sprite; Kenneth Kawamoto http://www.materiaprima.co.uk/ Allandt Bik-Elliott (Receptacle) wrote: hmmm - i'm a little stuck on this i'm trying to create a pop-up (will tween but i want to get it working first) but i want it to kill any previous one that's up - how would i go about this please? here's my current code: CODE private function createEventList(pbList_xl:XMLList):void { if (this.contains(eventList)) removeChild (eventList); // remove previous eventList if it's available - this is the bit that needs fixing var listLength:int = pbList_xl.length(); var listentryHeight:int = 15; var listHeight:int = listLength * listentryHeight; var listWidth:int= 50; var mousePoint:Point= new Point(root.mouseX, root.mouseY); // will tween from this point to a central point on the stage var eventList:Sprite = new Sprite(); eventList.graphics.beginFill(commonGrey, 1); eventList.graphics.drawRoundRect(0, 0, listWidth, listHeight, 10); eventList.x = mousePoint.x; eventList.y = mousePoint.y; addChild(eventList); } /CODE hope you can help a Allandt Bik-Elliott thefieldcomic.com e [EMAIL PROTECTED] ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] how to check if child exists
that said, i'd still like to know how to determine if a display object is in the current display list? thanks a On 2 Apr 2008, at 16:35, Kenneth Kawamoto wrote: Place outside of the function - private var eventList:Sprite; Kenneth Kawamoto http://www.materiaprima.co.uk/ Allandt Bik-Elliott (Receptacle) wrote: hmmm - i'm a little stuck on this i'm trying to create a pop-up (will tween but i want to get it working first) but i want it to kill any previous one that's up - how would i go about this please? here's my current code: CODE private function createEventList(pbList_xl:XMLList):void { if (this.contains(eventList)) removeChild (eventList); // remove previous eventList if it's available - this is the bit that needs fixing var listLength:int = pbList_xl.length(); var listentryHeight:int = 15; var listHeight:int = listLength * listentryHeight; var listWidth:int= 50; var mousePoint:Point= new Point(root.mouseX, root.mouseY); // will tween from this point to a central point on the stage var eventList:Sprite = new Sprite(); eventList.graphics.beginFill(commonGrey, 1); eventList.graphics.drawRoundRect(0, 0, listWidth, listHeight, 10); eventList.x = mousePoint.x; eventList.y = mousePoint.y; addChild(eventList); } /CODE hope you can help a Allandt Bik-Elliott thefieldcomic.com e [EMAIL PROTECTED] ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] how to check if child exists
From the help files and modified a bit. It is probably more efficient to keep track of names and the do a getChildByName(string) function traceDisplayList(container:DisplayObjectContainer, DispObjToCheck:DisplayObject) : Boolean { var child:DisplayObject; for (var i:uint=0; i container.numChildren; i++) { child = container.getChildAt(i); if(child == DispObjToCheck){ //found it and break out of the loop return true; } if (container.getChildAt(i) is DisplayObjectContainer) { traceDisplayList(DisplayObjectContainer(child), DispObjToCheck) } } return false } Jiri Allandt Bik-Elliott (Receptacle) wrote: that said, i'd still like to know how to determine if a display object is in the current display list? thanks a On 2 Apr 2008, at 16:35, Kenneth Kawamoto wrote: Place outside of the function - private var eventList:Sprite; Kenneth Kawamoto http://www.materiaprima.co.uk/ Allandt Bik-Elliott (Receptacle) wrote: hmmm - i'm a little stuck on this i'm trying to create a pop-up (will tween but i want to get it working first) but i want it to kill any previous one that's up - how would i go about this please? here's my current code: CODE private function createEventList(pbList_xl:XMLList):void { if (this.contains(eventList)) removeChild(eventList); // remove previous eventList if it's available - this is the bit that needs fixing var listLength:int = pbList_xl.length(); var listentryHeight:int = 15; var listHeight:int = listLength * listentryHeight; var listWidth:int= 50; var mousePoint:Point= new Point(root.mouseX, root.mouseY); // will tween from this point to a central point on the stage var eventList:Sprite = new Sprite(); eventList.graphics.beginFill(commonGrey, 1); eventList.graphics.drawRoundRect(0, 0, listWidth, listHeight, 10); eventList.x = mousePoint.x; eventList.y = mousePoint.y; addChild(eventList); } /CODE hope you can help a Allandt Bik-Elliott thefieldcomic.com e [EMAIL PROTECTED] ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] how to check if child exists
displayObjectContainer.contains(child) On Wed, Apr 2, 2008 at 9:36 AM, Allandt Bik-Elliott (Receptacle) [EMAIL PROTECTED] wrote: that said, i'd still like to know how to determine if a display object is in the current display list? thanks a On 2 Apr 2008, at 16:35, Kenneth Kawamoto wrote: Place outside of the function - private var eventList:Sprite; Kenneth Kawamoto http://www.materiaprima.co.uk/ Allandt Bik-Elliott (Receptacle) wrote: hmmm - i'm a little stuck on this i'm trying to create a pop-up (will tween but i want to get it working first) but i want it to kill any previous one that's up - how would i go about this please? here's my current code: CODE private function createEventList(pbList_xl:XMLList):void { if (this.contains(eventList)) removeChild(eventList); // remove previous eventList if it's available - this is the bit that needs fixing var listLength:int = pbList_xl.length(); var listentryHeight:int = 15; var listHeight:int = listLength * listentryHeight; var listWidth:int= 50; var mousePoint:Point= new Point(root.mouseX, root.mouseY); // will tween from this point to a central point on the stage var eventList:Sprite = new Sprite(); eventList.graphics.beginFill(commonGrey, 1); eventList.graphics.drawRoundRect(0, 0, listWidth, listHeight, 10); eventList.x = mousePoint.x; eventList.y = mousePoint.y; addChild(eventList); } /CODE hope you can help a Allandt Bik-Elliott thefieldcomic.com e [EMAIL PROTECTED] ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Ketan Anjaria 415.260.8742 f. 415-358-4278 [EMAIL PROTECTED] www.kidbombay.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] how to check if child exists
If the display object is checking itself, all you have to do is check to see if stage == null. Otherwise, you can see if its parent contains it. parentClip.contains(dispObj); that said, i'd still like to know how to determine if a display object is in the current display list? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] some dying logic ...
granted that the eventListener was added with a weak reference This seems to be one of the biggest mis-understandings these days. The listener does *not*add a reference to the object that you are listening too. For extensive discussion and proof of this issue you can read the following thread: http://www.mail-archive.com/flashcoders@chattyfig.figleaf.com/msg38700.html In short: adding a listener to an object will only create a reference from the object to the listener, not the other way around. This means that you can remove the object without removing the listener, the object will then still be garbage collected. Greetz Erik On 4/2/08, Meinte van't Kruis [EMAIL PROTECTED] wrote: granted that the eventListener was added with a weak reference On Wed, Apr 2, 2008 at 3:35 PM, EECOLOR [EMAIL PROTECTED] wrote: *if (this.basicNews != null) { this.basicNews.removeEventListener(RepeaterEvent.CLICK, this.onNewsClicked); this.removeChild(this.basicNews); this.basicNews.die(); this.basicNews = null; }* In the above code I do not see why you would need any more then the following lines: *basicNews = null; removeChild(basicNews);* All references to basicNews are now removed and it is (along with its children) marked for garbage collection. Calling the other extra methods seems a waste of CPU. Greetz Erik ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Interfaces
ah yeah!! How could I forget something like this :D I've been using listeners for similar tasks in this application. Woah. Keeping coding for more than 14 hours daily really comsumes the brain !!! On Wed, Apr 2, 2008 at 3:09 AM, Muzak [EMAIL PROTECTED] wrote: Have the panel with the button dispatch an event to which the parent (main) listens, The listener then takes care of things (like moving the panel). Interfaces have nothing to do with this. regards, Muzak - Original Message - From: Omar Fouad [EMAIL PROTECTED] To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wednesday, April 02, 2008 1:58 AM Subject: Re: [Flashcoders] Interfaces Well, the example in the blog explained it a lot, though it is in Actionscript 2.0. And yes, I wont need Interfaces unless I really feel like I HAVE to use them. In my project I have some Panels (screens) in the fla Library and each one of them is linked to a Class (linkage). Each class or Panel extends an abstract Class called APanel that extends MovieClip. The APanel Class contains some features that I need to be shared to all the other Panels. In the Main class, I managed how to switch them, based on the application flow and navigation. I use some navigation buttons that slide them to the right or to the left of the stage. Till here everything worked fine. But at a certain point I found some problematic issues. I also need the panels to slide when a certain button is pressed in one of them. Of course the function I used in the Main Class to slide the Panels away, wouldn't be available to the other classes unless I set them to be static, so I could write: Main.SlideLeft(); Fine. But to make the function static, I'd put in consideration some other things like turning some of the Main Class Properties used in the function to static. And that is a problem because library variables cannot be declared static. So I think that the use of an interface somewhere would solve the problem. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Omar M. Fouad - Digital Emotions http://www.omarfouad.net This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] books for flash programming
A native English speaker, when learning German, will generally remark Wow! Because of this feature in German, I now understand English a little better. Programming languages are the same way. Learning another object-oriented language will help you identify how features in ActionScript work (or don't work). And learning a language from another paradigm entirely (functional or procedural, probably) will help you identify weaknesses and strengths of object-oriented programming. Not to mention that a programmer who knows AS3, Java, and Lisp is immensely more valuable than one who just knows AS3. It proves you have the capacity to learn, which is a very marketable trait. On Tue, Apr 1, 2008 at 2:05 PM, Alan MacDougall [EMAIL PROTECTED] wrote: On 3/24/08, Naveen Bhaskar [EMAIL PROTECTED] wrote: Hi, I am a flash designer and I am in intermediate in programming.(AS2). anybody pls tellme what are the good books I can refer. And remember, just learning Actionscript in particular will not teach you programming in general. Jeff Atwood has an excellent list of books on topics essential to all programmers, even Actionscript programmers: http://www.codinghorror.com/blog/archives/20.html And if you really want to be a programmer, learn more than just Actionscript! A scripting language like Python, Ruby, or Perl will be extremely useful to you even as Flash developer -- but you'll never realize it until you've learned one. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Cory Petosky : Lead Developer : PUNY 1618 Central Ave NE Suite 130 Minneapolis, MN 55413 Office: 612.216.3924 Mobile: 240.422.9652 Fax: 612.605.9216 http://www.punyentertainment.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] AIR - Insert header in XML file
I'm saving an xml file with AIR, it works but how can I add ?xml version=1.0 encoding=UTF-8? at the top of the file? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AIR - Insert header in XML file
Can't you inject that into your xml string? myXml = ?xml version=1.0 encoding=UTF-8? + myXml; Patrick Matte | BLITZ wrote: I'm saving an xml file with AIR, it works but how can I add ?xml version=1.0 encoding=UTF-8? at the top of the file? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AIR - Insert header in XML file
You can set the xmlDecl property: AS3: XMLDocument().xmlDecl = ?xml version=1.0 encoding=utf-8?; AS2: XML().xmlDecl = ?xml version=1.0 encoding=utf-8?; On Wed, Apr 2, 2008 at 7:06 PM, Patrick Matte | BLITZ [EMAIL PROTECTED] wrote: I'm saving an xml file with AIR, it works but how can I add ?xml version=1.0 encoding=UTF-8? at the top of the file? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AIR - Insert header in XML file
Well, if you just use quotes properly, that is ;) '?xml version=1.0 encoding=utf-8?'; On Wed, Apr 2, 2008 at 7:45 PM, Wagner Amaral [EMAIL PROTECTED] wrote: You can set the xmlDecl property: AS3: XMLDocument().xmlDecl = ?xml version=1.0 encoding=utf-8?; AS2: XML().xmlDecl = ?xml version=1.0 encoding=utf-8?; On Wed, Apr 2, 2008 at 7:06 PM, Patrick Matte | BLITZ [EMAIL PROTECTED] wrote: I'm saving an xml file with AIR, it works but how can I add ?xml version=1.0 encoding=UTF-8? at the top of the file? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] AIR - Insert header in XML file
I was looking for a method like that under the XML class. Flash's help file is suggesting to use XML instead of XMLDocument which is AS2's xml legacy. But there doesn't seem to be anything like that method under the XML class... BLITZ | Patrick Matte - 310-551-0200 x214 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Wagner Amaral Sent: Wednesday, April 02, 2008 3:46 PM To: Flash Coders List Subject: Re: [Flashcoders] AIR - Insert header in XML file Well, if you just use quotes properly, that is ;) '?xml version=1.0 encoding=utf-8?'; On Wed, Apr 2, 2008 at 7:45 PM, Wagner Amaral [EMAIL PROTECTED] wrote: You can set the xmlDecl property: AS3: XMLDocument().xmlDecl = ?xml version=1.0 encoding=utf-8?; AS2: XML().xmlDecl = ?xml version=1.0 encoding=utf-8?; On Wed, Apr 2, 2008 at 7:06 PM, Patrick Matte | BLITZ [EMAIL PROTECTED] wrote: I'm saving an xml file with AIR, it works but how can I add ?xml version=1.0 encoding=UTF-8? at the top of the file? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AIR - Insert header in XML file
myString:String = yourXML.toString(); myString += ?xml delcaration here?; save(myString, myString.xml); An XML file is just a text file with a .xml extension. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] AIR - Insert header in XML file
No that didn't work, I got a weird error like wrong startendtag or something. BLITZ | Patrick Matte - 310-551-0200 x214 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Steven Sacks Sent: Wednesday, April 02, 2008 3:36 PM To: Flash Coders List Subject: Re: [Flashcoders] AIR - Insert header in XML file Can't you inject that into your xml string? myXml = ?xml version=1.0 encoding=UTF-8? + myXml; Patrick Matte | BLITZ wrote: I'm saving an xml file with AIR, it works but how can I add ?xml version=1.0 encoding=UTF-8? at the top of the file? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] books for flash programming
Not to mention that a programmer who knows AS3, Java, and Lisp is immensely more valuable than one who just knows AS3. It proves you have the capacity to learn, which is a very marketable trait. BS.. Doesn't prove a thing.. Someone who *just* knows AS3 may have - scratch that - *has* the capacity to learn any other language, but may never have had the need to. - Original Message - From: Cory Petosky [EMAIL PROTECTED] To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wednesday, April 02, 2008 11:54 PM Subject: Re: [Flashcoders] books for flash programming A native English speaker, when learning German, will generally remark Wow! Because of this feature in German, I now understand English a little better. Programming languages are the same way. Learning another object-oriented language will help you identify how features in ActionScript work (or don't work). And learning a language from another paradigm entirely (functional or procedural, probably) will help you identify weaknesses and strengths of object-oriented programming. Not to mention that a programmer who knows AS3, Java, and Lisp is immensely more valuable than one who just knows AS3. It proves you have the capacity to learn, which is a very marketable trait. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders