When to use ContainerMovieClip and when to use UIMovieClip? - actionscript-3

I am using Flex with Flash Builder 4 and it provides two classes to work with Custom Flash Professional components, the ContainerMovieClip and UIMovieClip.
I am confused on when to use a ContainerMovieClip and when to use a UIMovieClip.
Since ContainerMovieClip can hold only one component, I don't see how is it better than just placing the component directly on the design area.
I would have thought of using it as a inner frame to arrange multiple components that can be moved together by modifying the X,Y coordinates of the container, but I understand this isn't how it works, right?
I'd appriciate if you could answer this or direct me to an article on
1) When to use UIMovieClip and when to use a ContainerMovieClip?
2) Why ContainerMovieClip can hold only a single component?
Thanks.
RaamEE

Adobe's help docs are very useful and 90% of the time they will answer your questions.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/flash/UIMovieClip.html
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/flash/ContainerMovieClip.html

Related

flsh component slider with as3 class--huh?

attempting to add a flash component slider to my as 3 class and I cant find any examples on the web. I am surprised at the number of funky home made sliders i am seeing. Maybe there is a problem with flash components and as 3? Could you leave a note if this is doable, and any rough direction you could provide. thnks!!
The examples in the AS3 docs should give you the information you need.
Reasons not to use the slider component:
It adds 32KB to the size of your SWF. Not a great option where file size is critical.
It's not that difficult to code a slider which may be more suitable to your needs.
I wouldn't be (haven't been) afraid to use the built-in slider component, though.
You do need to make sure the component is in your FLA library before compiling. Including the code in your AS will not do since I beleive Flash needs all of the visual elements present.

3d objects in actionscript 3 without plugins

I am fairly new to actionscript and was wondering is it possible to create 3d shapes (cones, spheres, cubes) using actionscript.
I would like not to have to use a plugin.
The shapes must be 3d as I need to rotate them.
Here you will find Adobes documentation for what you are looking for:
http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS7D38179D-58B9-409c-9E5C-257DDECB1A02.html
Is there any specific reason that you don't want to use 3D libraries like away3D?
I think Matej's answer does not fully cover the topic as the link he gave only describes a classic display list approach to drawing 3D objects. Depending on your needs, drawing things using classic display list can be slow, as it is not GPU accelerated. If you want to utilize your GPU you can use Stage3D APIs - that does not require any external frameworks. Here's an excellent article for starters.
And even though you can render 3D content using 'raw' Context3D, I`d recommend using a framework like Away3D or Alternativa3D. Both are open source, by the way.

BorderLayout with GWT

How to achieve a true BorderLayout effect in GWT?
If possible without a library?
If I need to use a library, please not a payed one, neither a deprecated one?
From Kinjal's post, the 2.0 *LayoutPanel classes are almost certainly what you want. The DockLayoutPanel and its subclass the SplitLayoutPanel will provide this functionality in two different ways.
There are two important things about using Layout Panel classes. First, use a strict doctype (such as the html5 doctype). Second, all panels must be given a size and must be informed of resizes - this is why they all implement the RequiresResize interface.
The easiest way to do that is to start not with a RootPanel, but with a RootLayoutPanel - this will ensure that you get resize events from the browser window. Then, add in the layout panel of your choice, and it too will be resized.
If you build your own widget subclasses and want to be notified when resizing happens, you too should implement RequiresResize. Similarly, if you are building a widget subclass that will be sizing its children, you should implement the ProvidesResize interface.
Use HLayout or VLayout and set custom css style to achieve it.
You can also take a look at this Layout documentation

How to create a foaming or gases effect in flash?

I am trying to create an animation for lemon juice and baking soda experiment, and I was wondering how can I create a foaming effect such as the one shown in this image:
The idea I have in mind is to simply draw a foam in photoshop and then use motion tween to change the size. I was hoping I could find a better solution to this.
I have something somewhat similar that you can probably use as a springboard for doing your own thing.
http://www.shaunhusain.com/SteamEffect/
http://www.shaunhusain.com/SteamEffect/srcview/index.html
Currently I'm just drawing some circles with this and then setting a blur on them (not very efficient I know but it served the purposed as I didn't need it to create a bajillion particles to still be effective as "steam" which was the intended goal). You could swap out the shapes/filter I'm using for your own drawing and use the same basic structure.
EDIT
Perhaps this requires at least a little explanation:
Basically you'd want to look at the two files SteamCanvas.mxml and BitOfSteam.as. To be honest I have no idea why I decided to write SteamCanvas as an mxml file. I chose to use Canvas as the base class so I could just wrap it around any other component as a container and be able to detect mouse clicks anywhere within a region. If this is being used in a pure Flash environment, that is one not using the Flex libraries (or mxmlc compiler) it could be changed to extend from Sprite and be written purely in AS3, essentially just the creationComplete code should be moved to the constructor. How this works is the SteamCanvas is a wrapper for whatever controls or components you want to put in it (just like a normal canvas uses absolute positioning, but could have containers that define layout nested within it if need be). The SteamCanvas sets up a timer and if the mouse is down when the timer ticks, it creates instances of BitOfSteam and sets the properties for the steam based on the SteamCanvases own currently set properties. In the project you'll also see a SteamEffectTest.mxml which is just the file you see running that has the sliders on it to change the properties of the SteamCanvas, I used these to come up with what I thought were good values to make somewhat realistic steam. If I remember I'll revisit this component tomorrow and try to take Marty's suggestions to get it updated.

Data Paging With Pure AS3

I have a Flash Datagrid component being populated by data from Robotlegs services. However as the datagrid needs to show more and more rows of info I need to implement a way of loading the data as it is needed. Ideally this will be as the user scrolls down the list, I have seen this in Flex examples but I could do with a pure AS3 solution. Does anyone have any guidance or ideas how to approach this?
Here is the Flex example: http://www.jamesward.com/2010/10/11/data-paging-in-flex-4/
Any guidance would be appreciated.
I think you'll need to extend the Flash DG to use something like an AsyncListView and look at the AsyncListView to see how it does it, then write it to generate the correct events when an item isn't found, but remove any dependencies to Flex. You'll also need to do something that acts like the Responder class to support having different overlapping calls to the same service.