I'm very new in flash and flex and my first task is to be able to embed an SWF made in adobe cs4 using actionscript 3... the problem is I'm not able to embed it in Flex, it is weird though that if for example i add a sound to the swf file to be embedded in flash i'm able to hear the sound but it is not showing up (not visible) in the flex generated swf file
One other thing is if i try to set the flash swf to be embedded to use actionscript 2 then it gets shown in the flex generated swf but if i really need to be able to use actionscript 3 so no use for that
What is your code for embedding it ?
I suggest you to take a look at SWFLoader. Here is some code and samples:
http://livedocs.adobe.com/flex/3/html/help.html?content=controls_15.html
thanks for the answer, i was able to figure it our after some time, it really doesn't matter if i use an image or swfloader to load the embedded swf, the problem is i cannot really directly call a function of the embedded SWF from the embedding SWF, what i had to do was dispatch events so that flex can communicate with flash and vice versa,,, this page was very useful for me http://flash.fincanon.com/archives/152
Related
Is it possible to play MP3 files using the VideoDisplay or VideoPlayer components?
Thank you.
Actually, yes they can play MP3 files. I've just got it working by simply passing the path of the MP3 to a VideoPlayer component instance.
Although I wouldn't recommend using a video component to solely play audio files, I agree that it's sometimes appropriate to play a sound file in a video display component. In my case I have a mixed list of audio and video media items and want a unified preview area and playback/scrub controls.
Why would you use a video component to play a sound file? Either way, you should probably google before posting here. This is how you do it:
var snd:Sound = new Sound(new URLRequest("smallSound.mp3"));
snd.play();
Flex is good at produce code, whereas Flash is good at animation, how the integration is done? If I want to insert the animcation produced by flash, what's the recommend way to do the integration? Do I need to use SWFLoader?
It really depends on what you are doing. For most apps, you can simply have a Flash control embedded inside your Flex MXML design. You shouldn't need a book/tutorial for this, since it's just pointing the control's swf obj source to your swf - Adobe has lots of documentation on using the controls.
Ok, so I've been toying with using Flash SWFs in Flex objects as icons and the like. I can embed it just fine, but I would like more control over certain flash Actionscript 3 properties WITHIN the embedded icon - for example, to change the size of the icon (icon used in two spots, one should be small, the other large).
Once I get that figgured out, I also need to apply this to a TreeListItem's folderClosedIcon. That, however, is kindof secondary at the moment.
Thank you for any attention.
The most straightforward way is to pass properties via the flashvar property on your embed. This can also be done by passing the variables through the URL this way : "my.swf?buttonSize=20".
However if you need to communicate with the SWF after it's been loaded you can initialize a javascript-swf bridge thanks to ExternalInterface.
I'm creating a project in flex builder but it's not using the flex framework, it's just pure actionscript.
At the moment I have some bitmap resources embedded for drawing things, but I'd like a little animation and thought I could create swf animations for them in flash and use the [Embed()] thing to embed them in the actionscript project.
This works perfectly well for me, however I'm a little concerned about efficiency and how well this approach will scale when my project gets larger.
Does anyone know if there are any efficiency implications to embedding maybe 20 or 30 swf files, or do they get efficiently integrated into the main swf file? Most of the animations are really simple and I could probably redo them in actionscript if needed but it's a lot easier just to draw them in flash and embed them.
Not too sure exactly what you mean by efficiency, but embedding a large number of files is generally not considered best practice. You generally only want to embed things that need to show up immediately when the application loads, or that are so small it would be overkill to load them via URLLoader and the like.
Say you only view 5 of your animated swfs at startup, and the as the user clicks around and goes to different screens/views, they are revealed the rest. Then you could just load the swfs at runtime via URLLoader or the Flex Module architecture.
The benefit of having your swfs and assets not embeddded in your main swf is that:
it dramatically decreases swf size
it makes it easier to swap out graphics at runtime (or without needing to compile)
If I were you I would remove as many [Embed] tags as possible, and replace them with either loading via modules or urlloader.
Best,
Lance
I want to render a very simple Flex data grid. How do I anchor the SWF flash file in the HTML? Do I need to compile a special .swf or can I use a 'standard' data grid .swf - and just pass the data to it?
The way Flex works is you create an MXML file which contains your application definition (user interface, "states" to transition to, etc.). This is where your DataGrid would "live." You could also place a button in your user interface that, when clicked, would call an external data source and fill your grid (alternately, you could have it happen automatically when the application is started).
To create an MXML file, all you really need is a text editor and the Flex SDK, BUT, if you are new to programming Flex, you should look into purchasing Flex Builder (the download is for a trial version).
To get up to speed in Flex, I strongly recommend looking at Adobe's web site devoted to all things Flex. It's at http://www.adobe.com/devnet/flex/.
EDIT: For Linux, an alpha version of FlexBuilder is available at http://labs.adobe.com/technologies/flex/flexbuilder_linux/ (and the SDK download I mentioned previously should work on Linux as is). Download it and "install" it and you'll then be able to compile MXML files (at the command line) to SWF files for use on web sites. The original point, though, still remains; you'll need to learn more about Flex and ActionScript before you can create an SWF file and place it on a web page. That's where the DevNet site comes in.