Click here to ask Question NowIts free No registration required. Flash, Flex, Flash
Media Server, ActionScript,Adobe Air. Most questions receive a response in an hour.
question is not clear. Both flex and flash create swf files. do you want to communicate between two swf files in a html page or comunicate between loaded files ? Explain it
here our team is designing course player for that we need to change the course player(in the format of SWF) background color of the swf file...how can i communicate through MXML code to that of swf(flash application)?? r u getting it??? pls do reply!!!
to change the background color there is a parameter in the HTML, In HTML page change the background color parameter in Object and embed tags where your swf file is embedded
you cannot directly communicate with swf file. For communicating with a swf file you need to use actionscript. You need to create a local connection in flex swf file and your other swf file . After creating connection both files can communicate. Check this thread about creating local connection and using it
thanks for ur rply Rex !!!
i understand i need an action script file for communication.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" paddingTop="0" paddingBottom="0" paddingLeft="0" paddingRight="0" verticalGap="0" width="100%" height="100%" horizontalAlign="center" verticalAlign="middle" xmlns:local="*" >
CreationComplete="init()" />-->
<mx:Script>
<![CDATA[
import flash.display.MovieClip;
private var colorCode:uint = 0x000000;
private var loadedSWFMainTimeline:*;
private var loadedNumberSWFMainTimeline:*;
private function onSymbolSWFCompleted(event:Event):void
{
loadedSWFMainTimeline = symbolSWF.content as MovieClip;
loadedSWFMainTimeline.setColor(colorCode);
}
]>
</mx:Script>
<mx:SWFLoader id="symbolSWF" source="test1.swf" complete="onSymbolSWFCompleted(event);"/>
</mx:Application>
this is the above code for ur reference, the setColor is the function returned in the swf file and tat is accessed via mxml code through ActionScript but the color is not yet been applied at the swf.so this is the problem i am facing and more over i need an efficient way to communication with the swf through ActionScript and mxml. pls help me out folks!!!
a loaded swf does not have background. The background color is available for embeded swf file in html only. Any loaded file in another swf file is having transparent background and hence no color can be specified. You should instead keep a container below swf file and give it a color in flex.
In the previous post i have set the color thorough mxml code but the setColor () function has been written in the flash application but i felt this is not the effiecient method ...
any other ways RedBull....
why don't you give background color to your swf loader component in which you are loading the external swf. Simply set the backgroundColor property that's it. You don't need to set the background of swf
use canvas and place your swfloader component inside it. Now when you need to change the background color dynamically you can change the background color of canvas, it will look like as if background of swfloader is changed
<mx:Canvas id="mycanvas" backgroundColor="0x66CC66"/>
<mx:SWFLoader id="symbolSWF" source="test1.swf" complete="onSymbolSWFCompleted(event);"/>
</mx:Canvas>
// to change the background color dynamically call the below function and pass the new color
function changeColor(newColor:uint):void{
mycanvas.setStyle("backgroundColor", newColor);
}
swf file when loaded in another swf does not have a background so you must create your own background by using container like canvas. To my opinion this is the simplest way.
thks mug,
ya i understand, but the color we choose for the container may not choose for the transparent swf file. hope we can write an AS(ActionScript) code at the SWF file inorder to access its properties?? not sure can u look aft it pls!!!