First of all I don’t really use flex to do flex stuff and I’m not a big fan of flex. But in my latest project I had to build with flex an interface witch would be always diferent (a dynamic interface). In the beginning we thought in parsing some type of XML, but if we are in flex why not parse MXML? I took a look over the internet and I only found MXMLLoader component v0.01, witch didn’t compile on flex builder 3 and was really in the beginning. So there it is, as XMMLLoader class for flex builder 3. You just have to instantiate the class with the mxml :
Loading the swf is easy; you can make a normal loader and load it. And now the tricky part, if the swf is a swf flash file you can call the function you want, but in flex, because it have 2 frames, (first frame is just for loading), you need to wait until frame 2 is available, you can’t also access directly to a swf, you have to refer application before, so there’s the code:
you can also add Event Listener's to myClip.application , like myClip.addEventLIstener(“ON_CHANGEâ€,function), so by this way you can embed flex swf into an flash application and communicate with him by calling function and receiving events.
A time ago I had I little problem, I was doing an application and it had some severed changes, at some point I hasn’t capable of detect some mouse down events because I had a lot of sprites inside of sprites inside of movieClips with lots of event listeners and so on. So I and Hugo found this solution. Basically you put a generic mouse down event on stage and pass an array of objects with the name of the display object you want to catch the event and the name of the function you want to call. One good thing is that you can catch more than one event at the same time even if the displayObjects are in front of another displayObjects.
Note: this is really bad programming, if you can don’t use it, use only in severe cases.
This function can be used to test a hit between a displayObject with an amount of displaysObjects (Array). It will return the displayObject where the biggest contact area occurred. Note: it uses the bounding boxes.
How many times do we have an XML that comes from a webservice or from a sourceÂ
that we don't know. In these times getting that xml to a file can be cumbersome (imagine that you have authentication). So how about a nice little way to see all the node and attribute names in that xml, here's how:
For this file we'd get something like:
NODE NAME: Mouse
NODE NAME: ScreenSaver
ATTRIBUTE OF ScreenSaver NAME: desc
NODE CHILD OF ScreenSaver NAME: Active
ATTRIBUTE OF Active NAME: desc
NODE CHILD OF ScreenSaver NAME: File
ATTRIBUTE OF File NAME: desc
NODE CHILD OF ScreenSaver NAME: Time
ATTRIBUTE OF Time NAME: desc
ATTRIBUTE OF Time NAME: min
ATTRIBUTE OF Time NAME: max
ATTRIBUTE OF Time NAME: unit
To solve the problem of the image sequence I already know the solution, some time ago me and Pedro did something like this. This time I made two different versions, a class version (project in flex 3) and a component to flash cs3. With this solution, you can keep your images outside the project and manipulate them like a movieClip.
Arguments and Parameters
folder -> images folder.
filename -> first part of filename (ex: image1.jpg ), it should be "image".
type -> extension of the filename (jpg,png).
startImageNum-> first image number.
endImageNum->last Image numer.
For the class (ImageSequencer.as) version use:
For the component version:
Run “ImageSequencer.xmp†to install component. Run flash cs3, go to Windows > Components > Standard Components, drag ImageSequencer to the stage and fill the Parameters.
HLS color scheme can be awful to work with bitmapData, today we discover that motion tracking mechanisms can be improved using HLS, so there's a class for converting RBG to HLS and vice-versa.
Essentially what i'm doing here is instructing the compiler to add a frame
with myPreloader as a factory and calling my main file from it.
Should you have any questions feel free to ask, here is the swf.
Tinting a MovieClip is not a new thing, we see a lot of Web sites doing that, example: In a t-shirt selling store, you choose a shirt and then you can choose it color. But yesterday me and Pedro were talking that it could be nice to fill shapes with patterns, so it quite simple:
Today I had my first experiments with Papervision3D and after some time playing around I wanted to try having a double-faced Plane() with a different material on each face.
Its likely that a better way to do this exists, but one way to emulate a double-faced Plane() is to have a Cube with depth = 1, and hiding all but the front and back faces. Here's a and the code.
The hint to do this was from ldoru and the car in the images too!
 Update: I would not longer use such an approach to achieve a double-faced Plane() with a different material on each face. I would recommend using a DisplayObject3D with two normal one-face planes inside it.
+ Help the community
+ Explore the Flash platform
+ Create a better world
+ Research and play
Startups
We're looking for stories about startups using Flex/Flash technology. Drop us a quick e-mail or mention it to us via our Twitter account @dreaminginflash, thanks!