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