开发者

flex: referencing calling object from popUp

I have a situation where I have some images on screen with business properties(value, quantity, qualitygrade) assigned to them. When I click on them, a popUp window needs to open and allow me to change properties for the item under the image. How do I reference a) object that caused the popup to open b) properties of the object that are housed in a array- both for initial view and change

I have the images enabled for doubleclick as follow开发者_如何学Gos

newImage.doubleClickEnabled=true;
newImage.addEventListener(MouseEvent.DOUBLE_CLICK,createModifyPopUp);

I am currently calling the popUp window as follows

private function createModifyPopUp(evt:MouseEvent):void{
var mywin1:Modify=PopUpManager.createPopUp(this,Modify,true) as Modify;
PopUpManager.centerPopUp(mywin1);
}

I don't seem to be passing an event into the popup- Is there a way I can work based on the image clicked in the original application to build and capture information in the modify.


simply use PopUpManager.addPopup instead of PopUpManager.createPopUp

your example should look like this:

//define properties in the Modify class (Modify.as3 or Modify.mxml)
public var someData: Array;
public var eventTarget: Object;


// listener
private function createModifyPopUp(evt:MouseEvent):void{
   var modify: Modify = new Modify();
   // pass parameters to the instance of Modify class
   modify.someData = arr;
   modify.eventTarget = evt.target;

   // show popup
   PopUpManager.addPopUp(modify, this, true);
   PopUpManager.centerPopUp(modify);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜