hi to all. for long time i was searched how to access particular movie clip from one swf in flex.finally i got the solution for that.
step1:
create any one component in flash as3 only
step 2:
now create movie clip name for your button.
1.Right click your button select covert to symbol from the menu.
2.now you can see one dialoge box , in that box give name of your movie clip
then click ok button.
Step 4:
After finishing the above step see your property window (Click Ctrl+F3)
give some name for your instance through that only you can access your movie clip in flex.
Once you finished the above process click the file menu export the swf file save it some other place.
How to access created movie clip in to flex application?
Step 1:
Create new project in your flex builder.copy and paste that swf file into your project.
add one swf loader in your project give thae swf as source of the swfloader.
?xml version="1.0" encoding="utf-8"?>mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
mx:SWFLoader id="swf_mc" source="btn_mc.swf" />
/mx:Application>
Step 2:
now open Script tag in your Application.Create var for movie clip
![CDATA[
import mx.utils.ObjectUtil;
import mx.core.MovieClipAsset;
import mx.controls.Alert;
private var livinginstance:MovieClip;
private var tab_mc:movieclip;
private function onLoad():void
{
}
]]>
Step 3:
now right function for the movie clip access
private function onLoad():void
{
livinginstance=swf_mc.content as MovieClip;
livinginstance.buttonMode=true;
livinginstance.addEventListener(MouseEvent.CLICK,onClick);
}
Add listener for checking access of movie clip
private function onClick(eve:MouseEvent):void
{
Alert.show("Tab1");
}
call the onLoad() function into swf complete.
finally the application code is
?xml version="1.0" encoding="utf-8"?>mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
mx:Script>
![CDATA[
import mx.utils.ObjectUtil;
import mx.core.MovieClipAsset;
import mx.controls.Alert;
private var livinginstance:MovieClip;
private var tab_mc:movieclip;
private function onLoad():void
{
livinginstance=swf_mc.content as MovieClip;
livinginstance.buttonMode=true;
livinginstance.addEventListener(MouseEvent.CLICK,onClick);
}
private function onClick(eve:MouseEvent):void
{
Alert.show("Tab1");
}
]]>
/mx:Script>
mx:SWFLoader id="swf_mc" source="btn_mc.swf" complete="onLoad()"/>/mx:Application>
just run your application and click your movieclips .its shows alert messege.
I hope this post will helpful to some one...
This is a place for learning new things. "The greatest pleasure in life is doing what people say you cannot do"
Monday, June 14, 2010
Flex testing tools
Hi to all.here we discuss about testing tools for flex 3.
In this post i m explained how many tools we had in flex for testing our application.
basically we had many tools, but I'm shorted it.
1.Flex Unit
2.Flex Monkey
3.RIA test
Flex Monkey:
FlexMonkey is an Adobe AIR application used for testing Flex and AIR based applications. Providing the functionality to record, playback and verify Flex UI interactions, FlexMonkey also generates Action Script-based testing scripts that you can easily include within a continuous integration environment.
You can use this tool to see how user uses your application. It can log all the events like, clicks, scrollbars etc, which you can analyze later to see how user used it
For more details please refer the following links
http://www.adobe.com/devnet/flex/articles/flexmonkey.html
http://http//www.gorillalogic.com/fonemonkey/features%20
RIA Test:
RIATest is a GUI test automation tool for Adobe Flex applications. RIATest does for your GUI what FlexUnit does for your code.
refer:
http://www.riatest.com/
FlexUnit:
FlexUnit is a unit testing framework for Flex and ActionScript 3.0 applications and libraries. It mimics the functionality of JUnit, a Java unit testing framework, and comes with a graphical test runner.
Here are the links to both the releases of FlexUnit
http://opensource.adobe.com/wiki/display/flexunit/FlexUnit;jsessionid=FBE213CAA0E580729AFA0BAFB9EAE6BE
To learn how to use the FlexUnit see these tutorials and articles :
http://blog.blackpepper.co.uk/black-pepper-blog/Flex-unit-testing-and-continuous-integration.html
http://www.insideria.com/2008/04/unit-testing-with-flexunit-1.html
I hope the above information will helpful to someone who is new to flex testing tool.
In this post i m explained how many tools we had in flex for testing our application.
basically we had many tools, but I'm shorted it.
1.Flex Unit
2.Flex Monkey
3.RIA test
Flex Monkey:
FlexMonkey is an Adobe AIR application used for testing Flex and AIR based applications. Providing the functionality to record, playback and verify Flex UI interactions, FlexMonkey also generates Action Script-based testing scripts that you can easily include within a continuous integration environment.
You can use this tool to see how user uses your application. It can log all the events like, clicks, scrollbars etc, which you can analyze later to see how user used it
For more details please refer the following links
http://www.adobe.com/devnet/flex/articles/flexmonkey.html
http://http//www.gorillalogic.com/fonemonkey/features%20
RIA Test:
RIATest is a GUI test automation tool for Adobe Flex applications. RIATest does for your GUI what FlexUnit does for your code.
refer:
http://www.riatest.com/
FlexUnit:
FlexUnit is a unit testing framework for Flex and ActionScript 3.0 applications and libraries. It mimics the functionality of JUnit, a Java unit testing framework, and comes with a graphical test runner.
Here are the links to both the releases of FlexUnit
http://opensource.adobe.com/wiki/display/flexunit/FlexUnit;jsessionid=FBE213CAA0E580729AFA0BAFB9EAE6BE
To learn how to use the FlexUnit see these tutorials and articles :
http://blog.blackpepper.co.uk/black-pepper-blog/Flex-unit-testing-and-continuous-integration.html
http://www.insideria.com/2008/04/unit-testing-with-flexunit-1.html
I hope the above information will helpful to someone who is new to flex testing tool.
Monday, November 16, 2009
image enable
In flex, enable property doesn't work for image and radio button etc..here is the sample code for enable and disable the image events....
in the below code the image automatically disabled due to application complete...
once u click the button the image enabled and the event also occur....
code:
?xml version="1.0" encoding="utf-8"?>
mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="disableImages();">
mx:Script>
![CDATA[
import mx.controls.Alert;
private function disableImages():void{
//remove the click listener from image
myImg.alpha=0.2;
myImg.removeEventListener(MouseEvent.CLICK, btnClickHandle);
}
private function enableImages():void{
//remove the click listener from image
myImg.alpha=1;
myImg.addEventListener(MouseEvent.CLICK,btnClickHandle);
}
public function btnClickHandle(e:MouseEvent):void
{
Alert.show("enable");
}
]]>
/mx:Script>
mx:Image source="oscar_dresses.jpg" id="myImg"/>
mx:Button label="click" click="enableImages();"/>
/mx:Application>
in the below code the image automatically disabled due to application complete...
once u click the button the image enabled and the event also occur....
code:
?xml version="1.0" encoding="utf-8"?>
mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="disableImages();">
mx:Script>
![CDATA[
import mx.controls.Alert;
private function disableImages():void{
//remove the click listener from image
myImg.alpha=0.2;
myImg.removeEventListener(MouseEvent.CLICK, btnClickHandle);
}
private function enableImages():void{
//remove the click listener from image
myImg.alpha=1;
myImg.addEventListener(MouseEvent.CLICK,btnClickHandle);
}
public function btnClickHandle(e:MouseEvent):void
{
Alert.show("enable");
}
]]>
/mx:Script>
mx:Image source="oscar_dresses.jpg" id="myImg"/>
mx:Button label="click" click="enableImages();"/>
/mx:Application>
Subscribe to:
Posts (Atom)