 |
Forums |
Admin Start New Thread
By: fahad rao
RE: how 2 access custom AS3 objects through r [ reply ] 2007-11-23 13:40
|
hi peter! thanks for the reply.
I have tried what you suggested and i am able to access button click, if my event listener is declared with in the
constructor of class object.
But If i have 2 buttons being displayed with in the class at seperate locations (each with their own specific event
listeners) then i am unable to access any of the buttons.
for example this is my action script class
package {
public class BtnExample extends UIComponent{
public var TButton:Button;
public var SButton:Button;
public function BtnExample(){
super();
configureLabel();
//global event listener
//addEventListener(MouseEvent.CLICK,clickHandler);
}
public function configureLabel():void {
//button width height x and y removed
TButton = new Button();
TButton.id='T';
TButton.addEventListener(MouseEvent.CLICK,clickHandler1);
SButton = new Button();
SButton.id='S';
SButton.addEventListener(MouseEvent.CLICK,clickHandler2);
TButton.label = "HELLO WORLD!";
SButton.label = "HOW ARE YOU?";
addChild(TButton);
addChild(SButton);
}
public function clickHandler(vent:MouseEvent):void
{
mx.controls.Alert.show('class object clicked pressed');
}
public function clickHandler1(vent:MouseEvent):void
{
mx.controls.Alert.show('btn 1 pressed');
}
public function clickHandler2(vent:MouseEvent):void
{
mx.controls.Alert.show('btn 2 pressed');
}
}
}
this is how i have declared an object of this class in my MXML FILE
<ns1:TextFieldExample id="classobj" x="10" y="10" height="611" width="489"/>
i am using this statement to access the class object in ruby
@ie.button("classobj").click #works if listener in action script class is uncommented.
My question is that i want to access both buttons individually in RUBY, is there some way to do that? what hirerachy
would be followed in above shown code?
|
By: Peter Nicolai Motzfeldt
RE: how 2 access custom AS3 objects through r [ reply ] 2007-11-17 09:12
|
I think this works, have not tried it though. The framework relies on the fact that a Flex application is a hierarchy of components, either custom or predefined.
When you write for instance button("button_name").click in a Ruby script it does not actually need to be a button, but a Flex component that supports the event click.
I am not sure if this was comprehendable, but in short: as long as the component you have are in some way added as a child to the main mxml, it should work fine.
|
By: fahad rao
how 2 access custom AS3 objects through ruby [ reply ] 2007-11-12 13:59
|
i have just started using funfx. I have been able to access predefined objects which are created in mxml i.e(text_input, button, datagrid e.t.c.)
My question is that can we access custom components defined in Action Script class and then declared in mxml file?
Basically i have made mxml application which has only one object defined in it (as an AS class). what i want to do is to access objects (i.e text_Area) defined in the Action Script class via ruby script.. is that possible or not??
|
|
 |