Hi all, Need your help to solve 2 questions about createChild() and destroyChildAt().
My "JobNetCanves" have some images & lines.They all are created by using createChild(). 1.How can I give mouseOver,mouseOverEffect,mouseOut,mouseOutEffect,mouseUp events to createChild().(check ★).I want to give above affects to all created children which are on the "JobNetCanves". (In below code all mouseOver,mouseOverEffect,mouseOut,mouseOutEffect,mouseUp functions are working well) 2.Want to delete child at double click. What words I have to write in "destroyChildAt(JobNetCanves.getChildAt(★★));" Please help.. thanks ----------------------------------------------------------------------------- <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" pageTitle="Test Aplication"> <mx:Script> import mx.managers.DepthManager; var isMouseDown:Boolean = false; var lastClickTime:Number = 0; var deleteflag=1; <![CDATA[ [Embed("job1.jpg")] var job51:String; [Embed("job4.jpg")] var job54:String; //double-click function doubleClickDestroyChild(event):Void{ isMouseDown = false; setStyle("borderStyle", "none"); var now:Number = new Date().getTime(); if (now - lastClickTime < 300){ //alert("delete"); doDeleteChild(); }else{ lastClickTime = now; } } //destroy child function doDeleteChild() { destroyChildAt(JobNetCanves.getChildAt(★★)); } //mouse over effect function popToTop(target:mx.core.UIObject) { var parent = target.parent; var topSibling = parent.getChildAt(parent.numChildren-1); if (topSibling != target) target.setDepthAbove(topSibling); } //mouse out effect function restore(target:mx.core.UIObject) { var parent = target.parent; var childIndex = parent.getChildIndex(target); if (childIndex < parent.numChildren - 1) target.setDepthBelow(parent.getChildAt(childIndex+1)); } //create child function drawImagesAndArrows(target){ ★ var img1=target.createChild(mx.controls.Image,"", {source:job51, x:98, y:23,mouseOverEffect:"myZoom", mouseOver:"popToTop(event.target)",mouseOverEffect:"myZoom", mouseOut:"restore(event.target)",mouseOutEffect:"cut", mouseUp:"doubleClickDestroyChild(event)"}); var img4=target.createChild(mx.controls.Image,"", {source:job54, x:248, y:98}); var lines_comp =target.createChild(mx.containers.Canvas,"",{width:1920,height:1920}); drawLines(lines_comp,140, 40, 235, 100, 8, 0.5) } //draw lines function drawLines(lines,x1, y1, x2, y2, size, sharpness) { lines.lineStyle(2,0x000000,100); lines.moveTo(x1,y1); lines.lineTo(x2, y2); } ]]> </mx:Script> <mx:Effect> <mx:Zoom name="myZoom" zoomFrom="100" zoomTo="140" /> <mx:Zoom name="cut" zoomTo="100" duration="1" /> </mx:Effect> <mx:Panel width="100%" height="100%" title="Mypanel"> <mx:Canvas width="100%" height="100%"> <mx:Canvas id="JobNetCanves" x="0" y="110" width="100%" height="225" initialize="drawImagesAndArrows(event.target)" backgroundColor="#DEE0FE" vScrollPolicy="auto" backgroundAlpha="0"> </mx:Canvas> </mx:Canvas> </mx:Panel> </mx:Application> ------------------------ Yahoo! Groups Sponsor --------------------~--> Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life. http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/nhFolB/TM --------------------------------------------------------------------~-> -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/