passing values from 2 flex movies - apache-flex

I have a flex compiled swf module inside my flex program
I just need to pass it some values like I do it when I use
chat.swf?username=john : that works !
I tried it with flex swfLoader and Image
SWFLoader source="../bin-debug/chat.swf?username=john"
Image source="../bin-debug/chat.swf?username=john"
This does not work: these values are not passed !
what is the simplest way to do it ?
Regards

Load the swf up and set the variables on it normally like it was a regular object.

Related

Now able to get Id property for flex components

I am not able to get the Id property for flex components in my flex application(swf file) using Test Object Inspector in Rft Tool.
How can i get them?
You can't. Flex mxml component ids are only used as a hash within the containing parent. They're only used for referencing objects and are discarded at compile time.
If you have an id property for your flex component then there are a couple of ways to find out the id property of your desired control.
Make sure you have embeded your .swf file inside an html wrapper(as suggetsed by RFT) and displaying it in an enabled IE browser.
Hover over the component, say a button(and you should see automation name as well as id value).
Else you can do a simple script call to get the id of desired component:
System.out.println(desired_object().getProperty(".id"));

Flex 4 binding to mx:Image

Is it possible to bind a property (don't know which) of the mx:Image control, so that it is (should be) possible to get in form of a bytearray? (using Flex 4)
The reason i'm asking is this: i have to forward the bytearray to a WCF service to be stored and afterwards retrieved!
If this is not directly achievable is there a work-around ?
Thanks in advance!
If you load content into your image then when the Event.COMPLETE dispatches (on the image instance) the <imageInstance>.content.loaderInfo.bytes ByteArray holds the loaded data.
you can use BindingUtils.bindproperty to bind your object to the value of Image.source, like its described here in the docs

Export SWC from Flash and Access Child from Flex

I'm creating an actionscript project in Flex Builder. I succeed to export from Flash a SWC file, and to use it succesfully in Flex. I have a good programming background and Flex looks very simple for me, but I have difficult times in flash.
I'm trying to achieve something that might be very simple(not for me of course):
I create a simple shape in Flash, convert it to symbol. Then I create a TextField. The I select both the elements and convert them to another symbol, and Export it as a movieclip in swc.
In flex I want to change the value from the textfield. How should I do? I'm trying to do:
var t:ExportedMC = new ExportedMC();
t....(what should I write here)
As I mentioned when I open flash I feel like an elephant in a porcelain store. I have 2 questions here:
- how to assign a name to the textfield in flash? I'm using CS4.
- how to access it as a child in flex?
When you create the symbol in Flash and export it to actionscript (in symbol properties dialog), you created a class that is accessible in Flex (after including the resultant swc in flex project library path). Any controls/shapes/symbols within that class will be contained within and created along with the containing class.
If you have any objects/smybols in that class that you would like to access/modify/whatever, you need to give them an instance name (you can do it without this step, but it's more complicated). In Flash, you edit (doubleclick) the class object in the library, then select a particular sub-object/symbol/control in the class object and give it a name by entering something under in object properties tab. That name will be included in the exported class as an property that you can access as any other class property (width,height,x,y,...).
For example, if you have a ExportedMC symbol that includes a TextField control which you gave instance name ('txtFieldName', for example), you would access it in Flex like so:
var t:ExportedMC = new ExportedMC();
t.txtFieldName.text="something";
Flex will actually be able to autocomplete the property name on the class, so you'll easily be able to know if things worked out or not.
Hope this helps.

Displaying content from bulkLoader which is typed as MovieClip in Flex app

I know this is somehow trivial, but I couldn't find appropriate solution so please help me :)
I am using bulkLoader to load dozens of SWFs into my Flex app, and all of SWFs are static (1 frame only). 'Everything' works fine, however, I'm not sure how to handle data from bulkLoader... I am getting MovieClip types for all of my SWFs, and I am not sure how to tell to Image or SWFLoader classes to use some of those MovieClips as source...
Thanks for any help really :)
m.
The source property of the Image or SWFLoader class only stores the location of the file (URL or local path) as a string. If you set this property the class tries to load that file (with bindable blabla)
So, you can't overwrite the source property with a movie clip.
Maybe you could cast the MovieClip to an Image component using
var image:Image = bulkLoaderMovieClip as Image;
bye,
tux

flex 3 making application height dynamic based on datagrid size

I need to make my application height dynamic based on the size of a data grid which changes after a user does a search for specific items. Can someone help me with this.
Also when im embedding in my html is there a javascript function i can call which can access applicatin height so i can set page accordingly?
the javascript needs to be called from inside my html page so that i can get the dynamaic height
If your SWF embedding object has an ID (or any other means of unique identification, for that matter), then it is rather simple to change its size. Using jQuery, for example:
$("#swf").height(500);
This sets the height of the SWF to 500 pixels. It is fairly simple even without jQuery:
document.getElementById("swf").style.height = "500px";
To call javascript from inside Flash, use the ExternalInterface class, it has a static method for this purpose. (Alternatively, you may use the navigateToURL() static function with "javascript:" protocol.)

Resources