[Flashcoders] Tips for newbie
Hi all! Im new in Flash, but I have a long background in programming (php, C, asp, Flex, and there we go) for a long time. I was really into Flex' view, but after discussing with a friend, I've met and choosed Gaia Framework. Now I have the problem: Where to start? In Flex, it would be pretty simple tasks like dynamically add custom created components an passing parameters on them, but, how to do that in flash? Sorry if it sounds lazy, but, my cable is off and I need gather most tuff possible to get home and use it a lot at weekend. Thanks in advance -- Sidney G B Ferreira Desenvolvedor Web Cia2 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Tips for newbie
Hi Here are some quick tips. Look at the help docs in Flash IDE for: Programming ActionScript 3.0: Working with movie clips - Creating MovieClip objects with ActionScript. To summarise, you can use MovieClips to group together stuff into components (Not formal Flash Components in the Button, DataGrid, etc. sense - creating these is a bit more tricky because you have to follow certain rules - the principle that they collect a load of other MovieClip / Sprite based assets is the same as above, but the class heirarchy may be different. I would recommend following the tutorials / samples in Flash's help as these will be very useful.) I think if you use the Gaia Framework, it generates your FLA's for you and also AS3 classes that are linked to your page, you can then work in one of these FLA's to create components in the informal sense. The idea of creating components is similar to the way Gaia scaffolds your FLA's with classes that are linked to them - I am not sure how you would make your components available across the whole Gaia'd site - look in the doc's about Assets probably - but if you want to create a component in an individual page that you can instanciate in code: Make a MovieClip symbol, in the Advanced properties of the create dialog, choose to export for ActionScript. If you want to add behaviour to your symbol ~ to mx:Script in your MXML, you would create an AS3 class file and set this class file as the Class of your MovieClip. Then in other AS files used in the same FLA, you can instanciate by calling new ClassName() - you can add params to the constructor if you like too, but if you drag a copy of the Symbol on stage, Flash may moan because it creates the ClassName instance, but passes no params... Also, if you want to link your AS class to more than one symbol in the library of the same FLA, you will need to set it as the Base Class and use a different name for each Class property of the Symbol - Flash will automatically generate an class internal to the SWF with the same name and you would instanciate it with that name, but it would behave as the Base Class - like extends in php... For some good books - Keith Peter's Making Things Move is nice, because you do interesting things, but maybe it's not geared towards UI stuff completely. Colin Moock's AS3 book is about 3 times the size of the AS2 one, but invaluable. There are PDF sample chapters out there for lots of books - look on Friends Of Ed / O'Reilly for these and see what you think. Look at the Devnet site on Adobe too for loads of useful stuff I hope this is useful, it can be a bit fiddly getting stuff right - watch out for declaring your variables in code and flash's publish settings for AS3 (File-Publish Settings, Flash tab, Settings button), untick declare stage instances automatically. If you do have sub-components in a component on the stage, you need to give them an instance name - like the id attribute in Flex - the same as your variable in codeselect the clip on the stage in Flash and name it in the Properties panel in the box where it says Instance Name. If you instanciate anything dynamically you won't (should become obvious...). Also, like Flex, you may have to wait for the ADDED_TO_STAGE event before you can manipulate child clips that you add at author-time... Hope this is a bit useful :) Glen Sid Ferreira wrote: Hi all! Im new in Flash, but I have a long background in programming (php, C, asp, Flex, and there we go) for a long time. I was really into Flex' view, but after discussing with a friend, I've met and choosed Gaia Framework. Now I have the problem: Where to start? In Flex, it would be pretty simple tasks like dynamically add custom created components an passing parameters on them, but, how to do that in flash? Sorry if it sounds lazy, but, my cable is off and I need gather most tuff possible to get home and use it a lot at weekend. Thanks in advance -- Glen Pike 01326 218440 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] Tips for newbie
There is plenty of info in the Gaia documentation and Steven answers pretty much every post in the forum. Try to steer clear of non-gaia related questions though. A Gaia project starts with creating a new project in the Gaia panel. Then you edit the site.xml it generates to scaffold out the site, then back in the panel, you have it generate .fla's and document classes according to site.xml You can add an asset node to one of the parents (index or nav) to hold all of your components, then call functions in that assets Document class to return new instances. In Gaia, always attempt to use the api and asset subclasses (MovieClipAsset, NetStreamAsset, etc.) before rolling your own. On Fri, Mar 20, 2009 at 4:53 PM, Glen Pike postmas...@glenpike.co.ukwrote: Hi Here are some quick tips. Look at the help docs in Flash IDE for: Programming ActionScript 3.0: Working with movie clips - Creating MovieClip objects with ActionScript. To summarise, you can use MovieClips to group together stuff into components (Not formal Flash Components in the Button, DataGrid, etc. sense - creating these is a bit more tricky because you have to follow certain rules - the principle that they collect a load of other MovieClip / Sprite based assets is the same as above, but the class heirarchy may be different. I would recommend following the tutorials / samples in Flash's help as these will be very useful.) I think if you use the Gaia Framework, it generates your FLA's for you and also AS3 classes that are linked to your page, you can then work in one of these FLA's to create components in the informal sense. The idea of creating components is similar to the way Gaia scaffolds your FLA's with classes that are linked to them - I am not sure how you would make your components available across the whole Gaia'd site - look in the doc's about Assets probably - but if you want to create a component in an individual page that you can instanciate in code: Make a MovieClip symbol, in the Advanced properties of the create dialog, choose to export for ActionScript. If you want to add behaviour to your symbol ~ to mx:Script in your MXML, you would create an AS3 class file and set this class file as the Class of your MovieClip. Then in other AS files used in the same FLA, you can instanciate by calling new ClassName() - you can add params to the constructor if you like too, but if you drag a copy of the Symbol on stage, Flash may moan because it creates the ClassName instance, but passes no params... Also, if you want to link your AS class to more than one symbol in the library of the same FLA, you will need to set it as the Base Class and use a different name for each Class property of the Symbol - Flash will automatically generate an class internal to the SWF with the same name and you would instanciate it with that name, but it would behave as the Base Class - like extends in php... For some good books - Keith Peter's Making Things Move is nice, because you do interesting things, but maybe it's not geared towards UI stuff completely. Colin Moock's AS3 book is about 3 times the size of the AS2 one, but invaluable. There are PDF sample chapters out there for lots of books - look on Friends Of Ed / O'Reilly for these and see what you think. Look at the Devnet site on Adobe too for loads of useful stuff I hope this is useful, it can be a bit fiddly getting stuff right - watch out for declaring your variables in code and flash's publish settings for AS3 (File-Publish Settings, Flash tab, Settings button), untick declare stage instances automatically. If you do have sub-components in a component on the stage, you need to give them an instance name - like the id attribute in Flex - the same as your variable in codeselect the clip on the stage in Flash and name it in the Properties panel in the box where it says Instance Name. If you instanciate anything dynamically you won't (should become obvious...). Also, like Flex, you may have to wait for the ADDED_TO_STAGE event before you can manipulate child clips that you add at author-time... Hope this is a bit useful :) Glen Sid Ferreira wrote: Hi all! Im new in Flash, but I have a long background in programming (php, C, asp, Flex, and there we go) for a long time. I was really into Flex' view, but after discussing with a friend, I've met and choosed Gaia Framework. Now I have the problem: Where to start? In Flex, it would be pretty simple tasks like dynamically add custom created components an passing parameters on them, but, how to do that in flash? Sorry if it sounds lazy, but, my cable is off and I need gather most tuff possible to get home and use it a lot at weekend. Thanks in advance -- Glen Pike 01326 218440 www.glenpike.co.uk http://www.glenpike.co.uk ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com