header
ask question
Click here to ask Question Now Its free No registration required. Flash, Flex, Flash Media Server, ActionScript,Adobe Air. Most questions receive a response in an hour.
sakthivel
Points:0
Posts:0

10/10/2010 10:19:34 PM

Title: Flex to Flash Communication


how an flex application can efficiently communicate with flash?? help me out friends



1
RedBull
Points: 930
Posts:0
10/11/2010 9:35:48 AM



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

2
sakthivel.m
Points: 0
Posts:0
10/11/2010 9:04:08 PM



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!!!

3
Rex
Points: 1280
Posts:0
10/11/2010 9:36:47 PM



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

4
sakthivel.m
Points: 0
Posts:0
10/11/2010 9:42:17 PM



via MXML code how can i communicate with SWF?

5
Rex
Points: 1280
Posts:0
10/11/2010 9:55:13 PM



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

http://askmeflash.com/qdetail/1012/load-play-pause-avm1-content-in-avm2-parent

6
sakthivel.m
Points: 0
Posts:0
10/11/2010 10:17:22 PM



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!!!

7
sakthivel.m
Points: 0
Posts:0
10/13/2010 9:45:09 PM



help me out friends for the previous posted question !!!!

8
RedBull
Points: 930
Posts:0
10/14/2010 9:04:55 AM



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.

9
sakthivel.m
Points: 0
Posts:0
10/14/2010 10:18:55 PM



thks RedBull@

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....


10
Trillian
Points: 0
Posts:0
10/14/2010 10:28:45 PM



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

11
sakthivel.m
Points: 0
Posts:0
10/14/2010 11:40:03 PM



background color need to be changed dynamically ..

12
Mug
Points: 0
Posts:0
10/15/2010 12:53:55 AM



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);
}


13
sakthivel.m
Points: 0
Posts:0
10/15/2010 3:11:57 AM



hmm thnks mug!!!
is there any possible way to change the background of the swf file without the container(Canvas)???
pls help me out...

14
Mug
Points: 0
Posts:0
10/15/2010 9:08:10 AM



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.

15
sakthivel.m
Points: 0
Posts:0
10/17/2010 10:11:17 PM



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!!!


Post your Reply
Name  

Email

Type your Reply or Answer

Are you human? What is 2+7 



Members Login

Email  
Password
Forgot Password





This website focus on: Flash | Flex | FMS | RED5 | WOWZA | Flash Media Server | Adobe AIR | ActionScript,Flash Solutions | Flash Question | Flash Answers | Flash Developers | Flash Problem, Flash Help, Flash bugs, Flash workaround | Flash Blog | Flex Question Answers | Flash Forum | Flex Development | Actionscript development | Flash development | Adobe AIR development
Copyright © 2008 AskMeFlash.com. All rights reserved. Privacy Policy | Terms & Conditions