Naveen M. Reddy is welcoming U.

Naveen M. Reddy is welcoming U.
Welcome to My Small World.

Sunday, March 14, 2010

Flex:--> Calling a script function.





import mx.events.SliderEvent;
public function handleHS(event:SliderEvent):void{
     //trace(event.value);
     myImage.width = event.value;
}
public function handleVerticalSlider(event:SliderEvent):void{
    myImage.height = event.value;
}
]]>



When the slider is moved, change will occur and then the handleHS function will get called. This is how it is very simple calling the functions in flex.
These functions can be separated by placing them in an another file script file. This is same as separing the javascript file from the HTML page.

this change=""  attribute is for the HSlider similarly there are other attributes called click="" when the link or button is clicked. 
We can see here import statement import mx.events.SliderEvent; s This is how the class files will import when we want to use the classes of other package. Here SliderEvent is the class generated at the backend for the event of HSlider.
We can create a package structure and create a class there and import that class and use the properties of that class in this script tag and any where in other classes.
As I said, ActionScript is based on OOPS concept and we will see many other oops concept in AS.

No comments:

Post a Comment