Ask a Question related to Macromedia Flex General Discussion, Design and Development.
-
dam85 #1
Number of the object clicked
Hello,
i have this code.
How can i get the number of the button clicked?
i have to assign a number, when an user click on the button i have to get this
number to do my job..
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.events.FlexEvent;
import mx.controls.Button;
import mx.controls.Image;
import mx.containers.HBox;
private function init():void{
for(var i:int; i<6; i++){
var con:HBox = new HBox();
var icon:Image = new Image();
var bt1:Button = new Button()
var bt2:Button = new Button();
bt1.label=String(i);
bt2.label="X";
con.addChild(icon);
con.addChild(bt1);
con.addChild(bt2);
usersList.addChild(con);
}
}
private function click(event:Event):void{
trace(event.toString());
trace(event.target.toString());
trace(event.currentTarget.toString());
}
]]>
</mx:Script>
<mx:VBox id="usersList" creationComplete="init();" />
</mx:Application>
dam85 Guest
-
Which chart was clicked on?
Hi, event.target.name appears to give me what I'm after but is there a better (more usual) way of obtaining the id/name of the chart that was... -
Which cell was clicked
I would like to create a postBack when user click on the cell: In my dataGrid, I put the button column: <asp:buttoncolumn visible="false"... -
sort from the smallest number to the highest number
Hi Just say I want to sort the row by using the fifth column data as reference from the smallest the largest number, if using sort, It will give... -
Is there a way to + number in a shared object?
If you have a textfield like a scoreboard with the number 10 you can use: btn1.onPress = function() { _root.scoreboard += 5; }; to add 10... -
I need help on Array object, (summing number elements)
i.e : myArray = newArray() myArray = ; sum = Number(myArray+myArray+myArray); trace (sum) //traces 15 -
dam85 #2
Re: Number of the object clicked
i have to get the number of the "row" i mean row the number of the HBox inside the VBox
dam85 Guest
-
dietmar.paulus #3
Re: Number of the object clicked
Hey, what you can do is following,
add an EventListener to the HBox
con.addEventListener(MouseEvent.CLICK,click,false, 0,true);
give your HBox an id
con.id = "MyHBox" + i;
and in the eventHandler you have access to the HBox with
event.currentTarget
dietmar.paulus Guest
-
-
dietmar.paulus #5
Re: Number of the object clicked
write
private function click(event:Event):void{
trace(HBox(event.currentTarget).id );
}
then you trace your ID, what you have to do now is to "parse" your output so that you get the row
dietmar.paulus Guest



Reply With Quote

