Re: [Flashcoders] Re: Flash Projects workflow
Thanks Karl, Jason, I'll wait for your answer. And tell me if the movie is good. Have a good time. On Sat, Dec 19, 2009 at 2:54 AM, Karl DeSaulniers wrote: > Sorry for the echo. Forgot I already said that. :P > > Karl > > Sent from losPhone > > > On Dec 18, 2009, at 6:42 PM, Karl DeSaulniers > wrote: > > I am not an expert on classes, but couldn't you have a private var equal >> your public var after it gets initiated? >> >> Karl >> >> >> On Dec 18, 2009, at 3:58 PM, Omar Fouad wrote: >> >> No one? >>> >>> On Fri, Dec 18, 2009 at 6:03 PM, Omar Fouad >>> wrote: >>> >>> Hi all, I've been working with ActionScript 3.0 since 2006 and I used some technique in the last two years. I believed that this way is the best for splitting code from design, but today I asked myself whether this approach is REALLY professional or not. What I do is a create a pure ActionScript project in Flex Builder 3, and I create a FLA file with, which has in its library a bunch of assets that I use as components or models, such as buttons, list items, image containers with masks and so on - then I give each of the "component" a linkage name. For example, If I need to create a button I just create a MovieClip (or Sprite) in my library that represents this simple button designed the way it should be, this MovieClip contains a TextField named "label" and it is dynamic. It also contains a MovieClip named "background", which is the bg of the button behind the label. Finally I give this button a linkage Identifier "BasicButton". After that I publish the FLA and I create a Class that represents this button: package { import flash.display.Sprite; [Embed(source='Lib.swf', symbol='BasicButton')] public class BasicButton extends Sprite{ // and not MovieClip because it is based on one frame only // I declare the variables inside of it. They have to be public. public var label:TextField; public var background :Sprite; public function BasicButton(labelString:String) { label.text = labelString; this.buttonMode = true; this.addEventListener(MouseEvent.ROLL_OVER, onOver); this.addEventListener(MouseEvent.ROLL_OUT, onOut); } private function onOver(e:MouseEvent):void { //changes the background color on roll over } private function onOut(e:MouseEvent):void { //resets the background color on roll out } } } Of course I can create an abstract button class that has all the roll over and roll out instructions in it, and just make BasicButton an extension of it, but whatever this is just an example. In the Main class: package { import flash.display.Sprite; public class Main extends Sprite{ private var myButton:BasicButton; public function Main() { myButton = new BasicButton("Click Me"); myButton.addEventListener(MouseEvent.CLICK, onClick); addChild(myButton); } public function onClick(e:MouseEvent) { trace("button clicked"); } } This works and all of course. And I can also embed the button inside of Main and give it a variable of type Class, but in this cases I needed to have it in a different Class to be able to give it more functions. This gives me flexibility when I need to make design tweaks to this button (or all the other assets), but I've found a problem, which is that I cannot make things encapsulated since the variables "label" and "background" inside of BasicButton HAVE to be public (if I declare them as private it won't compile). So in a way getters and setters have no use for such instances. How can I maintain encapsulation in this case? Or it's just this a good way to create flash content? Thank you Cordially. -- Omar M. Fouad - http://omarfouad.net Cellular: (+20) 10 234.66.33 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. >>> >>> >>> -- >>> Omar M. Fouad - Adobe™ Flash© Platform Developer >>> http:
Re: [Flashcoders] Re: Flash Projects workflow
Sorry for the echo. Forgot I already said that. :P Karl Sent from losPhone On Dec 18, 2009, at 6:42 PM, Karl DeSaulniers wrote: I am not an expert on classes, but couldn't you have a private var equal your public var after it gets initiated? Karl On Dec 18, 2009, at 3:58 PM, Omar Fouad wrote: No one? On Fri, Dec 18, 2009 at 6:03 PM, Omar Fouad wrote: Hi all, I've been working with ActionScript 3.0 since 2006 and I used some technique in the last two years. I believed that this way is the best for splitting code from design, but today I asked myself whether this approach is REALLY professional or not. What I do is a create a pure ActionScript project in Flex Builder 3, and I create a FLA file with, which has in its library a bunch of assets that I use as components or models, such as buttons, list items, image containers with masks and so on - then I give each of the "component" a linkage name. For example, If I need to create a button I just create a MovieClip (or Sprite) in my library that represents this simple button designed the way it should be, this MovieClip contains a TextField named "label" and it is dynamic. It also contains a MovieClip named "background", which is the bg of the button behind the label. Finally I give this button a linkage Identifier "BasicButton". After that I publish the FLA and I create a Class that represents this button: package { import flash.display.Sprite; [Embed(source='Lib.swf', symbol='BasicButton')] public class BasicButton extends Sprite{ // and not MovieClip because it is based on one frame only // I declare the variables inside of it. They have to be public. public var label:TextField; public var background :Sprite; public function BasicButton(labelString:String) { label.text = labelString; this.buttonMode = true; this.addEventListener(MouseEvent.ROLL_OVER, onOver); this.addEventListener(MouseEvent.ROLL_OUT, onOut); } private function onOver(e:MouseEvent):void { //changes the background color on roll over } private function onOut(e:MouseEvent):void { //resets the background color on roll out } } } Of course I can create an abstract button class that has all the roll over and roll out instructions in it, and just make BasicButton an extension of it, but whatever this is just an example. In the Main class: package { import flash.display.Sprite; public class Main extends Sprite{ private var myButton:BasicButton; public function Main() { myButton = new BasicButton("Click Me"); myButton.addEventListener(MouseEvent.CLICK, onClick); addChild(myButton); } public function onClick(e:MouseEvent) { trace("button clicked"); } } This works and all of course. And I can also embed the button inside of Main and give it a variable of type Class, but in this cases I needed to have it in a different Class to be able to give it more functions. This gives me flexibility when I need to make design tweaks to this button (or all the other assets), but I've found a problem, which is that I cannot make things encapsulated since the variables "label" and "background" inside of BasicButton HAVE to be public (if I declare them as private it won't compile). So in a way getters and setters have no use for such instances. How can I maintain encapsulation in this case? Or it's just this a good way to create flash content? Thank you Cordially. -- Omar M. Fouad - http://omarfouad.net Cellular: (+20) 10 234.66.33 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. -- Omar M. Fouad - Adobe™ Flash© Platform Developer http://.omarfouad.net Cellular: (+20) 1011.88.534 / (+20) 1444.37.175 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 Karl DeSaulniers Design Drumm http://designdrumm.com __
Re: [Flashcoders] Re: Flash Projects workflow
I am not an expert on classes, but couldn't you have a private var equal your public var after it gets initiated? Karl On Dec 18, 2009, at 3:58 PM, Omar Fouad wrote: No one? On Fri, Dec 18, 2009 at 6:03 PM, Omar Fouad wrote: Hi all, I've been working with ActionScript 3.0 since 2006 and I used some technique in the last two years. I believed that this way is the best for splitting code from design, but today I asked myself whether this approach is REALLY professional or not. What I do is a create a pure ActionScript project in Flex Builder 3, and I create a FLA file with, which has in its library a bunch of assets that I use as components or models, such as buttons, list items, image containers with masks and so on - then I give each of the "component" a linkage name. For example, If I need to create a button I just create a MovieClip (or Sprite) in my library that represents this simple button designed the way it should be, this MovieClip contains a TextField named "label" and it is dynamic. It also contains a MovieClip named "background", which is the bg of the button behind the label. Finally I give this button a linkage Identifier "BasicButton". After that I publish the FLA and I create a Class that represents this button: package { import flash.display.Sprite; [Embed(source='Lib.swf', symbol='BasicButton')] public class BasicButton extends Sprite{ // and not MovieClip because it is based on one frame only // I declare the variables inside of it. They have to be public. public var label:TextField; public var background :Sprite; public function BasicButton(labelString:String) { label.text = labelString; this.buttonMode = true; this.addEventListener(MouseEvent.ROLL_OVER, onOver); this.addEventListener(MouseEvent.ROLL_OUT, onOut); } private function onOver(e:MouseEvent):void { //changes the background color on roll over } private function onOut(e:MouseEvent):void { //resets the background color on roll out } } } Of course I can create an abstract button class that has all the roll over and roll out instructions in it, and just make BasicButton an extension of it, but whatever this is just an example. In the Main class: package { import flash.display.Sprite; public class Main extends Sprite{ private var myButton:BasicButton; public function Main() { myButton = new BasicButton("Click Me"); myButton.addEventListener(MouseEvent.CLICK, onClick); addChild(myButton); } public function onClick(e:MouseEvent) { trace("button clicked"); } } This works and all of course. And I can also embed the button inside of Main and give it a variable of type Class, but in this cases I needed to have it in a different Class to be able to give it more functions. This gives me flexibility when I need to make design tweaks to this button (or all the other assets), but I've found a problem, which is that I cannot make things encapsulated since the variables "label" and "background" inside of BasicButton HAVE to be public (if I declare them as private it won't compile). So in a way getters and setters have no use for such instances. How can I maintain encapsulation in this case? Or it's just this a good way to create flash content? Thank you Cordially. -- Omar M. Fouad - http://omarfouad.net Cellular: (+20) 10 234.66.33 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. -- Omar M. Fouad - Adobe™ Flash© Platform Developer http://.omarfouad.net Cellular: (+20) 1011.88.534 / (+20) 1444.37.175 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 Karl DeSaulniers Design Drumm http://designdrumm.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/list
RE: [Flashcoders] Re: Flash Projects workflow
This is a good question, and I'd like to weigh in, I'm just slammed right now! And going to see Avatar in 2 hours. I'll see if I can look at this later - sorry Omar. I also think a lot of people have taken off for the holidays Jason Merrill Bank of America Global Learning Learning & Performance Soluions Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (note: these are for Bank of America employees only) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Omar Fouad Sent: Friday, December 18, 2009 4:58 PM To: Flash Coders List Subject: [Flashcoders] Re: Flash Projects workflow No one? On Fri, Dec 18, 2009 at 6:03 PM, Omar Fouad wrote: > Hi all, > > I've been working with ActionScript 3.0 since 2006 and I used some > technique in the last two years. I believed that this way is the best for > splitting code from design, but today I asked myself whether this approach > is REALLY professional or not. > What I do is a create a pure ActionScript project in Flex Builder 3, and I > create a FLA file with, which has in its library a bunch of assets that I > use as components or models, such as buttons, list items, image containers > with masks and so on - then I give each of the "component" a linkage name. > > For example, If I need to create a button I just create a MovieClip (or > Sprite) in my library that represents this simple button designed the way it > should be, this MovieClip contains a TextField named "label" and it is > dynamic. It also contains a MovieClip named "background", which is the bg of > the button behind the label. Finally I give this button a linkage Identifier > "BasicButton". > > After that I publish the FLA and I create a Class that represents this > button: > > > package { > > import flash.display.Sprite; > > [Embed(source='Lib.swf', symbol='BasicButton')] > public class BasicButton extends Sprite{ // and not MovieClip because > it is based on one frame only > > // I declare the variables inside of it. They have to be > public. > public var label:TextField; > public var background :Sprite; > > public function BasicButton(labelString:String) { > > label.text = labelString; > this.buttonMode = true; > this.addEventListener(MouseEvent.ROLL_OVER, onOver); > this.addEventListener(MouseEvent.ROLL_OUT, onOut); > } > > private function onOver(e:MouseEvent):void { > //changes the background color on roll over > } > private function onOut(e:MouseEvent):void { >//resets the background color on roll out > } > > } > } > > Of course I can create an abstract button class that has all the roll over > and roll out instructions in it, and just make BasicButton an extension of > it, but whatever this is just an example. > > In the Main class: > > package { > > import flash.display.Sprite; > > public class Main extends Sprite{ > > private var myButton:BasicButton; > > public function Main() { > myButton = new BasicButton("Click Me"); > myButton.addEventListener(MouseEvent.CLICK, onClick); > addChild(myButton); > } > public function onClick(e:MouseEvent) { > trace("button clicked"); > > } > > > } > > This works and all of course. And I can also embed the button inside of > Main and give it a variable of type Class, but in this cases I needed to > have it in a different Class to be able to give it more functions. > This gives me flexibility when I need to make design tweaks to this button > (or all the other assets), but I've found a problem, which is that I cannot > make things encapsulated since the variables "label" and "background" inside > of BasicButton HAVE to be public (if I declare them as private it won't > compile). So in a way getters and setters have no use for such instances. > > How can I maintain encapsulation in this case? Or it's just this a good way > to create flash content? > > Thank you > > Cordially. > > > -- > Omar M. Fouad - > http://omarfouad.net > Cellular: (+20) 10 234.66.33 > > > 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 lega
[Flashcoders] Re: Flash Projects workflow
No one? On Fri, Dec 18, 2009 at 6:03 PM, Omar Fouad wrote: > Hi all, > > I've been working with ActionScript 3.0 since 2006 and I used some > technique in the last two years. I believed that this way is the best for > splitting code from design, but today I asked myself whether this approach > is REALLY professional or not. > What I do is a create a pure ActionScript project in Flex Builder 3, and I > create a FLA file with, which has in its library a bunch of assets that I > use as components or models, such as buttons, list items, image containers > with masks and so on - then I give each of the "component" a linkage name. > > For example, If I need to create a button I just create a MovieClip (or > Sprite) in my library that represents this simple button designed the way it > should be, this MovieClip contains a TextField named "label" and it is > dynamic. It also contains a MovieClip named "background", which is the bg of > the button behind the label. Finally I give this button a linkage Identifier > "BasicButton". > > After that I publish the FLA and I create a Class that represents this > button: > > > package { > > import flash.display.Sprite; > > [Embed(source='Lib.swf', symbol='BasicButton')] > public class BasicButton extends Sprite{ // and not MovieClip because > it is based on one frame only > > // I declare the variables inside of it. They have to be > public. > public var label:TextField; > public var background :Sprite; > > public function BasicButton(labelString:String) { > > label.text = labelString; > this.buttonMode = true; > this.addEventListener(MouseEvent.ROLL_OVER, onOver); > this.addEventListener(MouseEvent.ROLL_OUT, onOut); > } > > private function onOver(e:MouseEvent):void { > //changes the background color on roll over > } > private function onOut(e:MouseEvent):void { >//resets the background color on roll out > } > > } > } > > Of course I can create an abstract button class that has all the roll over > and roll out instructions in it, and just make BasicButton an extension of > it, but whatever this is just an example. > > In the Main class: > > package { > > import flash.display.Sprite; > > public class Main extends Sprite{ > > private var myButton:BasicButton; > > public function Main() { > myButton = new BasicButton("Click Me"); > myButton.addEventListener(MouseEvent.CLICK, onClick); > addChild(myButton); > } > public function onClick(e:MouseEvent) { > trace("button clicked"); > > } > > > } > > This works and all of course. And I can also embed the button inside of > Main and give it a variable of type Class, but in this cases I needed to > have it in a different Class to be able to give it more functions. > This gives me flexibility when I need to make design tweaks to this button > (or all the other assets), but I've found a problem, which is that I cannot > make things encapsulated since the variables "label" and "background" inside > of BasicButton HAVE to be public (if I declare them as private it won't > compile). So in a way getters and setters have no use for such instances. > > How can I maintain encapsulation in this case? Or it's just this a good way > to create flash content? > > Thank you > > Cordially. > > > -- > Omar M. Fouad - > http://omarfouad.net > Cellular: (+20) 10 234.66.33 > > > 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. > -- Omar M. Fouad - Adobe™ Flash© Platform Developer http://.omarfouad.net Cellular: (+20) 1011.88.534 / (+20) 1444.37.175 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