Re: [flexcoders] Question about drawing on the canvas
Hi Manish all, The solution is to make it a child (add a new object as a child and draw on top of that object instead). sorry... , I didn't get the point yet.Is it Mean.. addedObject = Object(myCanves.createChild()); addedObject.createChild(arrow(target)); or var ref_mc =myCanves.createChild(mx.containers.Canvas,undefined,{width:1000}); ref_mc.createChild(arrow(target)); Please explain me little more. Thanks On 10/4/05, Prasad Dhananjaya [EMAIL PROTECTED] wrote: Have a simple question about drawing on the canvas. Below code draws an arrow between mousedown point and mouseup point. It works well. But... When I move canvas's scrollbar, arrow didn't move. Means it is NOT on the canvas.Want to draw it ON the canvas. Tried several ways. But failed. (I drawing square on the canvas using fillRect() is OK) It indeed is on the Canvas, but it's not a child of the Canvas, and that's the reason it doesn't scroll along with other children. The solution is to make it a child (add a new object as a child and draw on top of that object instead). From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Prasad Dhananjaya Sent: Tuesday, October 04, 2005 6:48 AM To: FlexML Subject: [flexcoders] Question about drawing on the canvas Hi, Have a simple question about drawing on the canvas. Below code draws an arrow between mousedown point and mouseup point. It works well. But... When I move canvas's scrollbar, arrow didn't move. Means it is NOT on the canvas.Want to draw it ON the canvas. Tried several ways. But failed. (I drawing square on the canvas using fillRect() is OK) Can someone please tell me what's wrong. thanks, -- ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml; mx:Script ![CDATA[ var isPointerStarted = false; var bx:Number; var by:Number; function pointerStart(target) { if (isPointerStarted) return; isPointerStarted = true; bx = target.mouseX; by = target.mouseY; } function pointerReleased(target) { if (!isPointerStarted) return; target.lineStyle(2, 0x66, 100); target.createChild(arrow(target)); isPointerStarted = false; //drawing squre on the canves var ref_mc = target.createChild(mx.containers.Canvas,undefined,{width:1000}); ref_mc.fillRect(900, 100, 910, 110, 0x00, 30); } function arrow(target) { var w = target.mouseX - bx; var h = target.mouseY - by; var l = Math.sqrt(w * w + h * h); var size=8; var sharpness=0.5; var s = Math.sin(sharpness); var c = Math.cos(sharpness); if(l0){ w *= size / l; h *= size / l; target.moveTo(bx,by); target.lineTo(target.mouseX, target.mouseY); target.lineTo(target.mouseX - w * c - s * h, target.mouseY + w * s - h * c); target.moveTo(target.mouseX, target.mouseY); target.lineTo(target.mouseX - w * c + s * h, target.mouseY - w * s - h * c); } } ]] /mx:Script mx:Canvas id=myCanves x=0 y=110 width=100% height=225 borderStyle=solid mouseUpSomewhere=pointerReleased(event.target) mouseDown=pointerStart(event.target) backgroundColor=#DEE0FE backgroundAlpha=0 /mx:Canvas /mx:Application Yahoo! Groups Sponsor ~-- Fair play? Video games influencing politics. Click and talk back! http://us.click.yahoo.com/T8sf5C/tzNLAA/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/
[flexcoders] Question about drawing on the canvas
Hi, Have a simple question about drawing on the canvas. Below code draws an arrow between mousedown point and mouseup point. It works well. But... When I move canvas's scrollbar, arrow didn't move. Means it is NOT on the canvas.Want to draw it ON the canvas. Tried several ways. But failed. (I drawing square on the canvas using fillRect() is OK) Can someone please tell me what's wrong. thanks, -- ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml; mx:Script ![CDATA[ var isPointerStarted = false; var bx:Number; var by:Number; function pointerStart(target) { if (isPointerStarted) return; isPointerStarted = true; bx = target.mouseX; by = target.mouseY; } function pointerReleased(target) { if (!isPointerStarted) return; target.lineStyle(2, 0x66, 100); ★ target.createChild(arrow(target)); isPointerStarted = false; //drawing squre on the canves var ref_mc = target.createChild(mx.containers.Canvas,undefined,{width:1000}); ref_mc.fillRect(900, 100, 910, 110, 0x00, 30); } function arrow(target) { var w = target.mouseX - bx; var h = target.mouseY - by; var l = Math.sqrt(w * w + h * h); var size=8; var sharpness=0.5; var s = Math.sin(sharpness); var c = Math.cos(sharpness); if(l0){ w *= size / l; h *= size / l; target.moveTo(bx,by); target.lineTo(target.mouseX, target.mouseY); target.lineTo(target.mouseX - w * c - s * h, target.mouseY + w * s - h * c); target.moveTo(target.mouseX, target.mouseY); target.lineTo(target.mouseX - w * c + s * h, target.mouseY - w * s - h * c); } } ]] /mx:Script mx:Canvas id=myCanves x=0 y=110 width=100% height=225 borderStyle=solid mouseUpSomewhere=pointerReleased(event.target) mouseDown=pointerStart(event.target) backgroundColor=#DEE0FE backgroundAlpha=0 /mx:Canvas /mx:Application - Yahoo! Groups Sponsor ~-- Fair play? Video games influencing politics. Click and talk back! http://us.click.yahoo.com/T8sf5C/tzNLAA/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/
[flexcoders] Questing about Automatic Scrolling
Hi, Have a problem with automatic Scrolling. Can someone help me.. There are 2 canvas in my test application. Size of the JobNetCanves is 10 times than fullMapCanves. On the fullMapCanves there is a image(call selector) which is dragable inside the canvas. What I want to do is .. when I move selector, scrollbar of JobNetCanves also want to move automatically.(When moving selector inside the fullMapCanves,left top cordinates of the JobNetCanves is same as selector.x*10, selector.y*10) Can someone tell me how to do this.. thanks. P.S. I think I can do this with using vPosition hPosition . But not clear how to get/set values. -- ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml; xmlns=* pageTitle=TestAppli mx:Script ![CDATA[ var vScrollValue; var hScrollValue; //Drawing coordinates on JobNetCanves function drawStuff(event){ var xx:Number; var yy:Number; var ref_mc = JobNetCanves.createChild(mx.containers.Canvas,undefined,{width:4000, height:1500}); for (xx=35;xx4000;xx=xx+75){ for (yy=35;yy1500;yy=yy+75){ ref_mc.fillRect(xx, yy, xx+5, yy+5, 0x00, 30); } } } //Drawing coordinates on fullMapCanves function drawStuff1(event){ var xv:Number; var yv:Number; var ref_mc = fullMapCanves.createChild(mx.containers.Canvas,undefined,{width:400, height:150}); for (xv=3;xv400;xv=xv+7){ for (yv=3;yv150;yv=yv+7){ ref_mc.fillRect(xv, yv, xv+1, yv+1, 0x00, 30); } } } var bIsDown:Boolean = false; var lastX:Number; var lastY:Number; function doMouseDown(){ bIsDown = true; var lastX = mouseX; var lastY = mouseY; } function doMouseUp(){ bIsDown = false; dispatchEvent({type: selectionChanged, x1: selector.x, x2: selector.x+selector.width, y1: selector.y, y2: selector.y+selector.height}); var hScrollValue=selector.x; var vScrollValue=selector.y; } function doMouseMove(){ if (bIsDown){ var deltaX = mouseX - lastX; var deltaY = mouseY - lastY; selector.x += deltaX; selector.y += deltaY; lastX = mouseX; lastY = mouseY; } } ]] /mx:Script mx:Panel width=100% height=100% title=Testpanel mx:Canvas width=100% height=100% mx:Canvas id=JobNetCanves x=0 y=0 width=100% height=225 backgroundColor=#CC creationComplete=drawStuff() vScrollPolicy=on mouseMove=doMouseMove() ★ vPosition={vScrollValue} hPosition={hScrollValue} /mx:Canvas mx:Canvas id=fullMapCanves x=3 y=225 width=400 height=150 backgroundAlpha=100 backgroundColor=#DEE0FE creationComplete=drawStuff1() mouseMove=doMouseMove() mx:Image id=selector source=jo1.jpg width=10 height=10 mouseDown=doMouseDown() mouseUp=doMouseUp()/ /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/
[flexcoders] Question about destroyChild()
Hi all, Is it possible to destroy child by specifying x,y coordinates. I used createChild() to draw square. --code-start-- var xvalue:Number=100; var yvalue:Number=100; var ref_mc1 = myCanves.createChild(mx.containers.Canvas,undefined,{percentWidth:100, percentHeight:100}); ref_mc1.fillRect(xvalue, yvalue, xvalue+8, yvalue+8, 0x00, 100); -code-end- Now I want to delete it by specifying xvalue, yvalue. How can I specify x,y coordinates to getChildIndex(). Is it possible? --code-start-- var xvalue:Number=100; var yvalue:Number=100; var iChildIndex:Number = myCanves.getChildIndex(event.target); myCanves.destroyChildAt(iChildIndex); -code-end- Thanks, 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/
Re: [flexcoders] Questions about createChild() and destroyChildAt()
Hi all, Still I have a problem with destroyChild().I want to destroy only img1. But it destroys every thing on the application including panel,canvas. Not only selected child. can someone tell me why it is destroying every thing. thanks Prasad - ?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; import mx.utils.Delegate; ![CDATA[ [Embed(job1.jpg)] var job51:String; //destroy child function doubleClickDestroyChild(event):Void{ var iChildIndex:Number = JobNetCanves.getChildIndex(event.target); destroyChildAt(iChildIndex); } //create child function drawImagesAndArrows(target){ var img1=target.createChild(mx.controls.Image,, {source:job51, x:98, y:23}); img1.addEventListener(mouseUp,Delegate.create(this, doubleClickDestroyChild)); } ]] /mx:Script 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 /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/
Re: [flexcoders] Questions about createChild() and destroyChildAt()
Hi Nischal, Thanks a lot. Now it works. Regards, Prasad Prasad: Use JobNetCanves.destroyChildAt(iChildIndex); statement to remove child element. Regards, Nischal Pathania From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Prasad Dhananjaya Sent: Friday, September 30, 2005 06:05 To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Questions about createChild() and destroyChildAt() Hi all, Still I have a problem with destroyChild().I want to destroy only img1. But it destroys every thing on the application including panel,canvas. Not only selected child. can someone tell me why it is destroying every thing. thanks Prasad - ?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; import mx.utils.Delegate; ![CDATA[ [Embed(job1.jpg)] var job51:String; //destroy child function doubleClickDestroyChild(event):Void{ var iChildIndex:Number = JobNetCanves.getChildIndex(event.target); destroyChildAt(iChildIndex); } //create child function drawImagesAndArrows(target){ var img1=target.createChild(mx.controls.Image,, {source:job51, x:98, y:23}); img1.addEventListener(mouseUp,Delegate.create(this, doubleClickDestroyChild)); } ]] /mx:Script 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 /mx:Canvas /mx:Canvas /mx:Panel /mx:Application -- 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 * Visit your group flexcoders on the web. * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. -- 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 Yahoo! Groups Sponsor ~-- Fair play? Video games influencing politics. Click and talk back! http://us.click.yahoo.com/T8sf5C/tzNLAA/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/
[flexcoders] Questions about createChild() and destroyChildAt()
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,0x00,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/
[flexcoders] setting effects to createChild()
Hi All, Can someone tell me how to set effects(mouseOver,mouseOverEffect,mouseOut,mouseOutEffect,mouseUpevents) to createChild().Below line is not working(and giving no compile errors). Checked several docs. But found nothing helpful. var img=target.createChild(mx.controls.Image,, {source:img23, x:9, y:2, mouseOverEffect:myZoom, mouseOver:popToTop(event.target), mouseOverEffect:myZoom, mouseOut:restore(event.target), mouseOutEffect:cut, mouseUp:doubleClickDestroyChild(event)}); P.S. What I want to do is to set effects to all createChild components which are on the canvas.Is there any way to do this easily. Thanks, Prasad Yahoo! Groups Sponsor ~-- Fair play? Video games influencing politics. Click and talk back! http://us.click.yahoo.com/T8sf5C/tzNLAA/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/
Re: [flexcoders] Question about mouseMove
Hi, Thanks for your reply. Now it's working. But still have a problem. I can't use clear(), because it deletes all previously drawn arrows. Any other way to do this with out deleting other arrows which are on the canvas? Thanks, ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml; backgroundColor=#FF mx:Script ![CDATA[ var isPointerStarted = false; var bx:Number; var by:Number; function mouseMoveHandler(event) { if (!isPointerStarted) return; ★mycanvas1.clear();★ mycanvas1.lineStyle(1, 0xFF, 30); mycanvas1.createChild(drawingArrow()); updateAfterEvent(); } function pointerStart() { if (isPointerStarted) return; isPointerStarted = true; bx = mycanvas1.mouseX; by = mycanvas1.mouseY; } function pointerReleased() { if (!isPointerStarted) return; mycanvas1.lineStyle(2.5, 0x66, 100); mycanvas1.createChild(drawingArrow()); isPointerStarted = false; } function drawingArrow(){ var w = mycanvas1.mouseX - bx; var h = mycanvas1.mouseY - by; var l = Math.sqrt(w * w + h * h); var size=8; var sharpness=0.5; var s = Math.sin(sharpness); var c = Math.cos(sharpness); if(l0 ){ w *= size / l; h *= size / l; mycanvas1.moveTo(bx,by); mycanvas1.lineTo(mycanvas1.mouseX, mycanvas1.mouseY); mycanvas1.lineTo(mycanvas1.mouseX - w * c - s * h, mycanvas1.mouseY + w * s - h * c); mycanvas1.moveTo(mycanvas1.mouseX, mycanvas1.mouseY); mycanvas1.lineTo(mycanvas1.mouseX - w * c + s * h, mycanvas1.mouseY - w * s - h * c); } } ]] /mx:Script mx:Canvas id=mycanvas1 mouseDown=pointerStart() mouseUpSomewhere=pointerReleased() width=700 height=400 borderStyle=solid backgroundColor=#DDEEFF backgroundAlpha=0 mouseMove=mouseMoveHandler(event) /mx:Canvas /mx:Application - You need to call your draw function via mouseMove, but have the drawing algo clear() each time. Additionally, add an updateAfterEvent() at the end of your function since mouseMoves can happen faster than the screen can redraw. The mouseUp function will then call the same function, only once. - Original Message - From: Tracy Spratt [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Wednesday, September 21, 2005 12:34 PM Subject: RE: [flexcoders] Question about mouseMove I am not sure how to implement this or how this would affect your performance, but you probably need to use a doLater() to let the screen update. Tracy -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Prasad Dhananjaya Sent: Wednesday, September 21, 2005 7:21 AM To: FlexML Subject: [flexcoders] Question about mouseMove Hi, I have a small question about mouseMove action. Below code draws an arrow between mouseDown point and mouseUp point. It works well. But arrow displays only after mouseUp event.I want to display arrow during moving of mouse (before I do mouseUp). I think I have to add something to mouseMoveHandler(). But didn't know what? Can someone tell me how can I do this? Thanks, 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/
[flexcoders] Question about mouseMove
Hi, I have a small question about mouseMove action. Below code draws an arrow between mouseDown point and mouseUp point. It works well. But arrow displays only after mouseUp event.I want to display arrow during moving of mouse (before I do mouseUp). I think I have to add something to mouseMoveHandler(). But didn't know what? Can someone tell me how can I do this? Thanks, - ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml; backgroundColor=#FF mx:Script ![CDATA[ var isPointerStarted = false; var tmp_canvas:Object; var bx:Number=20; var by:Number=20; function mouseMoveHandler(event) { if (!isPointerStarted) return; } function pointerStart() { if (isPointerStarted) return; isPointerStarted = true; bx = mycanvas1.mouseX; by = mycanvas1.mouseY; } function pointerReleased() { if (!isPointerStarted) return; mycanvas1.lineStyle(2, 0x00, 100); var w = mycanvas1.mouseX - bx; var h = mycanvas1.mouseY - by; var l = Math.sqrt(w * w + h * h); var size=6; var sharpness=0.5; var s = Math.sin(sharpness); var c = Math.cos(sharpness); //Drawing arrow if (w10 || h10){ w *= size / l; h *= size / l; mycanvas1.moveTo(bx,by); mycanvas1.lineTo(mycanvas1.mouseX, mycanvas1.mouseY); mycanvas1.lineTo(mycanvas1.mouseX - w * c - s * h, mycanvas1.mouseY + w * s - h * c); mycanvas1.moveTo(mycanvas1.mouseX, mycanvas1.mouseY); mycanvas1.lineTo(mycanvas1.mouseX - w * c + s * h, mycanvas1.mouseY - w * s - h * c); } isPointerStarted = false; } ]] /mx:Script mx:Canvas id=mycanvas1 mouseDown=pointerStart() mouseUpSomewhere=pointerReleased() width=700 height=400 borderStyle=solid backgroundColor=#DDEEFF backgroundAlpha=0 mouseMove=mouseMoveHandler(event) /mx:Canvas /mx:Application Yahoo! Groups Sponsor ~-- Fair play? Video games influencing politics. Click and talk back! http://us.click.yahoo.com/T8sf5C/tzNLAA/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/
[flexcoders] Question about moving of dragged image
Hi all, I have a problem with moving of dragged image. Can someone help me to solve this. There is a image(job1.jpg) in the canvas cvs. DragDrop of job1.jpg to canvas(JobNetCanves) is working well. After drop it to JobNetCanves, it can't move again. I want to redrag it and drop freely inside the JobNetCanves canvas.(In other words want to re-locate job1.jpg anyway in the JobNetCanves). moving an image inside the JobNetCanves is OK. Image of job13.jpg can re-locate freely inside the JobNetCanves(It is not a dragged image from cvs) I think, If I can use job13's dragMe() and myoffset() functions to job1, job1.jpg,it may move freely inside the JobNetCanves after dragging it from canvas cvs. How can I specify dragMe() and myoffset() as property of createChild()? Or is there any other way to do this. Thanks -- ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml; xmlns=* creationComplete=initApp() pageTitle=testApp mx:Script ![CDATA[ //Drag a image from cvs canvas and drop it to JobNetCanves. After drop this can't be redragging. var bMouseDown:Boolean = false; var objectBeingDragged:Object; var origLocs:Object = {}; var targets:Object = {}; function initApp() { origLocs[job1] = {x:job1.x, y:job1.y}; targets[job1] = JobNetCanves; cvs.setDepthAbove(JobNetCanves); } function handleMouseDown(event) { bMouseDown = true; objectBeingDragged = event.target; } function handleMouseMoveSomewhere(event) { if(bMouseDown) { objectBeingDragged.startDrag(true); updateAfterEvent(); } } function handleMouseUpSomewhere(event) { if(bMouseDown) { objectBeingDragged.stopDrag(); bMouseDown = false; var x = objectBeingDragged.x + objectBeingDragged.width/2; var y = objectBeingDragged.y + objectBeingDragged.height/2; var target = targets[objectBeingDragged]; var tx = target.x; var ty = target.y; var th = target.height; var tw = target.width; if ((x = tx x= (tx + tw)) (y = ty y= (ty + th))) { ★★target.createChild(mx.controls.Image,, {source:objectBeingDragged.source, autoLoad:true, width:32, height:32, x:JobNetCanves.mouseX, y:JobNetCanves.mouseY, mouseDown:dragMe(event, 'Image', 'img');myoffset(Image)}); objectBeingDragged.visible = true; } objectBeingDragged.x = origLocs[objectBeingDragged].x; objectBeingDragged.y = origLocs[objectBeingDragged].y; objectBeingDragged = null; } } //Dragdrop image(job13) in side the canves(JobNetCanves) import mx.managers.DragManager; import mx.core.DragSource; var xOff:Number; var yOff:Number; var choseiFlag:Number=1; function dragMe(event, img1, format) { var ds = new DragSource() ds.addData(img1, format); DragManager.doDrag(event.target, ds, mx.controls.Image,{source:event.target.source}); } function doDragEnter(event) { event.handled = true; event.action=DragManager.MOVE } function doDragDrop(event,target1, format) { job13.x = target1.mouseX - xOff; job13.y = target1.mouseY - yOff; job1.x = target1.mouseX - xOff; job1.y = target1.mouseY - yOff; } function myoffset(img){ xOff = img.mouseX yOff = img.mouseY } ]] /mx:Script mx:Panel width=100% height=100% title=Panel1 mx:Canvas width=100% height=84% mx:Canvas x=0 y=3 id=cvs width=100% height=50 backgroundColor=#B9C6F9 backgroundAlpha=100 mx:Grid x=1 y=1 mx:GridRow mx:GridItem backgroundAlpha=1 width=60 x=-30 y=2 mx:GridItem mx:Image source=job1.jpg id=job1 width=32 height=32 mouseOverEffect=Fade mouseDownEffect=Dissolve mouseDown=handleMouseDown(event) mouseMoveSomewhere=handleMouseMoveSomewhere(event) mouseUpSomewhere=handleMouseUpSomewhere(event) backgroundColor=#B9C6F9/ /mx:GridItem /mx:GridItem
[flexcoders] Checking existance of file
Hi, Can someone tell me how to check existence of file. Checked several docs. But found nothing useful. I tried to do this with getURL(). But it is trying to open test.txt. I don't want to open. Just want to check it's existence. thanks - if(getURL(../test.txt)==false) { alert(File don't exist); } else alert(File exists); } - Yahoo! Groups Sponsor ~-- Fair play? Video games influencing politics. Click and talk back! http://us.click.yahoo.com/T8sf5C/tzNLAA/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/
[flexcoders] How to check existance of file
Hi, Can someone tell me how to check existence of file. Checked several docs. But found nothing useful. I tried to do this with getURL().When use it, it is trying to open test.txt. I don't want to open. Just want to check it's existence. thanks - if(getURL(../test.txt)==false) { alert(File don't exist); } else alert(File exists); } Yahoo! Groups Sponsor ~-- Fair play? Video games influencing politics. Click and talk back! http://us.click.yahoo.com/T8sf5C/tzNLAA/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/
[flexcoders] How to change the button's image after click
Hi, I want to change the button's image(icon image) after click. (use this as toggle button) I tried several ways, but failed. Can someone tell me how to do this? thanks - ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml; mx:Script ![CDATA[ var first:String = true; function changeImage() { if (first==true){ but1.load('ob2.jpg'); first=false; } else { but1.load('ob1.jpg'); first=true; } } ]] /mx:Script mx:VBox mx:Button id=but1 click=changeImage() / /mx:VBox /mx:Application - Yahoo! Groups Sponsor ~-- Most low income households are not online. Help bridge the digital divide today! http://us.click.yahoo.com/cd_AJB/QnQLAA/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/
[flexcoders] getting data from xml file
Hello, I hava a small problem with getting data from xml file. What I want to do is get the image data from xml file and display image on canves. When I'm trying to run this application, getting the following error Problem parsing external XML. And also I am not sure of writing varible(is this correct jobrepeat.jobs.job. ?). If somebody could help, I would appreciate it. Thanks, ---readxmlfile.mxml-- ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml; mx:Model id=jobdata source=jobdata.xml/ mx:Panel mx:Canvas width=100% height=100% backgroundColor=#F4FECF mx:Canvas x=3 y=10 width=640 height=400 backgroundColor=#D3EFFE mx:Repeater id=jobrepeat dataProvider={jobdata} mx:Image source={jobrepeat.jobs.job.imageid} x={jobrepeat.jobs.job.xcordinate} y={jobrepeat.jobs.job.ycordinate} /mx:Image /mx:Repeater /mx:Canvas /mx:Canvas /mx:Panel /mx:Application jobdata.xml-- ?xml version=1.0 encoding=utf-8? jobs job jobnamejob1/jobname jobid200/jobid xcordinate100/xcordinate ycordinate100/ycordinate imageidjob1.jpg/imageid /job job jobnamejob2/jobname jobid300/jobid xcordinate200/xcordinate ycordinate100/ycordinate imageidjob2.jpg/imageid /job /jobs -- Yahoo! Groups Sponsor ~-- Fair play? Video games influencing politics. Click and talk back! http://us.click.yahoo.com/T8sf5C/tzNLAA/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/
[flexcoders] Drag and drop among components
Hi all, I want to drag a image from GridItem and drop it on Canvas (Just drag drop).With referring flex samples(Dragdrop--Custom class example) I wrote below code. But it is not working. This is my first dragdrop(among components) code and I am not sure what's wrong. Can someone help... Thanks, Prasad - ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml; mx:Script ![CDATA[ function beginDrag1() { var ds = new mx.core.DragSource(); mx.managers.DragManager.doDrag(this, ds,Canves1); } function doDragEnter1(event){ event.handled=true; } function doDragExit1(event) { event.target.hideDropFeedback(); } function doDragOver1(event) { event.target.showDropFeedback(); } function doDragDrop1(event) { doDragExit1(event); } ]] /mx:Script mx:Panel width=100% height=100% title=panel1 mx:Canvas width=100% height=100% mx:Canvas x=3 y=2 width=100% height=50 backgroundColor=#B9C6F9 mx:Grid x=1 y=1 mx:GridRow mx:GridItem mx:GridItem mx:Image source=jo2.jpg width=32 height=32 id=dg mouseMove=beginDrag1()/ /mx:GridItem mx:GridItem mx:Image source=jo3.jpg width=32 height=32 id=dg1 mouseMove=beginDrag1()/ /mx:GridItem /mx:GridItem /mx:GridRow /mx:Grid /mx:Canvas !-- Drop Target -- mx:Canvas id=Canves1 x=4 y=65 width=100% height=225 dragEnter=doDragEnter1(event) dragExit=doDragExit1(event) dragDrop=doDragDrop1(event) dragOver=doDragOver1(event) backgroundColor=#DEE0FE vScrollPolicy=auto visible=true /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/
[flexcoders] Question about moving image
Hi all, I am making some test programs with the help of tutorials and Flex samples. But have a problem with implementing below function. I am very glad if someone can give me a advise, sample code or url of document which I can refer. what I want to make is: 1.In the application there is a canvas and GridItem(images). 2.When I click(mouse button is pressed down and released) on the image and then move the mouse pointer to the canvas, clicked image will appear on the canvas with mouse pointer. (When I move mouse pointer inside the canvas image also moves with mousepointer) 3.when I click(mouse button is pressed down and released) on the canvas then image drops on the canvas(at the clicked place). Thanks Prasad Here's the mxml code: --- ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml; mx:Panel width=100% height=100% title=Panal1 mx:Canvas width=100% height=100% mx:Canvas x=0 y=0 width=100% height=50 backgroundColor=#B9C6F9 mx:Grid x=1 y=1 mx:GridRow mx:GridItem mx:GridItem mx:Image source=Image1.jpg id=jo2 width=32 height=32/ /mx:GridItem mx:GridItem mx:Image source=Image2.jpg id=jo3 width=32 height=32/ /mx:GridItem /mx:GridItem /mx:GridRow /mx:Grid /mx:Canvas mx:Canvas id=Canvas1 x=1 y=61 width=100% height=225 backgroundColor=#DEE0FE vScrollPolicy=auto visible=true/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/
[flexcoders] Drawing on canvas
Hi All, I want to draw some dots on the canvas(which are going to use as codinates) and I did it. But when I move scrollbar(vScrollbar or HScrollbar) these dots are not moving. They are fixed(may be not on the canvas). But image12.jpgis on the canvas and when I move scrollbar it also moves. Plesae tell me how can I draw these dots on the canves. Thanks Prasad --- ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml; mx:Script ![CDATA[ function drawDots(){ var xx:Number=35; var yy:Number=35; var ref_mc = this.Canves1.createEmptyObject(square, this.getNextHighestDepth()); for (var i:Number=0;i=15;i++){ ref_mc.fillRect(xx, yy, xx+5, yy+5, 0x00, 100); xx=xx+75; yy=yy;75; } } ]] /mx:Script mx:Panel width=100% height=100% title=Panel1 mx:Canvas id=Canves1 x=0 y=110 width=100% height=225 backgroundColor=#DEE0FE vScrollPolicy=auto creationComplete=drawDots() visible=true mx:Image x=2205 y=2382 source=image12.jpg width=32 height=32 / /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/
[flexcoders] Loading classes
Hi All, I want to draw two squares inside the canves. I define DrawIconsclass. My class file and MXML file is in the same directory. When I run this, it says The class DrawIcons()could not be loaded (line of error is var Square1:DrawIcons = new DrawIcons(100, 200);) Can someone please tell me what's the wrong with this code? Thanks, Prasad (Absolute beginner of Flex ActionScript, Studying using of classes) --square.mxml--- mx:Application width=800 height=600 xmlns:mx=http://www.macromedia.com/2003/mxml; mx:Script ![CDATA[ function callDrawIcons(){ var Square1:DrawIcons = new DrawIcons(100, 200); var Square2:DrawIcons = new DrawIcons(100, 300); Square1.createSquare(); Square2.createSquare(); } ]] /mx:Script mx:Canvas id=MyCanves width=600 height=400 initialize=callDrawIcons()/mx:Canvas /mx:Application --- -DrawIcons.as-- //Class definition class DrawIcons { var xValue:Number; var yValue:Number; //Contractor function DrawIcons(cordiX:Number,cordiY:Number){ this.Xvalue=cordiX; this.Yvalue=cordiY; } //Drawing square function createSquare() { var square_mc:MovieClip; square_mc = MyCanves.createEmptyMovieClip(square_mc,getNextHighestDepth()); square_mc.lineStyle(1, 0x00, 100); square_mc.beginFill(0xFF, 100); square_mc.moveTo(0, 0); square_mc.lineTo(50, 0); square_mc.lineTo(50, 50); square_mc.lineTo(0, 50); square_mc.lineTo(0, 0); square_mc.endFill(); square_mc._x = this.Xvalue; square_mc._y = this.Yvalue; } } Yahoo! Groups Sponsor ~-- Fair play? Video games influencing politics. Click and talk back! http://us.click.yahoo.com/T8sf5C/tzNLAA/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/
[flexcoders] Calling functions
Hi All, I have a small question. I want to call function line() and function arrow() from function drawlinesArrows(). I tried sevaral ways. But failed. Can someone tell me how to do this? Best Regards, Prasad (Absolute beginner of Flex ActionScript) ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml; mx:Panel width=732 title=MyPanel mx:Canvas id =mycanvas width=715 height=408 backgroundColor=#FF initialize=drawlines(event.target) /mx:Canvas /mx:Panel mx:Script ![CDATA[ function line(x1, y1, x2, y2) { moveTo(x1, y1); lineTo(x2, y2); } function arrow(x1, y1, x2, y2, size) { . } function drawlinesArrows(target) { var lines = target.createEmptyMovieClip(line_mc, 1); with (lines) { lineStyle(1, 0xff, 100); //★below two lines are not working line(145, 25,192, 88); arrow(100, 100, 300, 300, 10, 0.4); } } ]] /mx:Script /mx:Application Yahoo! Groups Sponsor ~-- font face=arial size=-1a href=http://us.ard.yahoo.com/SIG=12h2q9vf0/M=362329.6886308.7839368.1510227/D=groups/S=1705007207:TM/Y=YAHOO/EXP=1124790522/A=2894321/R=0/SIG=11dvsfulr/*http://youthnoise.com/page.php?page_id=1992 Fair play? Video games influencing politics. Click and talk back!/a./font ~- -- 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/
Re: [flexcoders] Calling functions
Hi, Thank you very much for the reply. I tried it. But still not working.(Didn't call line() and arrow() functions) Any other errors? Best Regards, Prasad ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml; mx:Panel width=732 title=MyPanel mx:Canvas id =mycanvas width=715 height=408 backgroundColor=#FF initialize=drawlines(event.target) /mx:Canvas /mx:Panel mx:Script ![CDATA[ function line(x1, y1, x2, y2) { moveTo(x1, y1); lineTo(x2, y2); } function arrow(x1, y1, x2, y2, size, sharpness) { var w = x2 - x1; var h = y2 - y1; var l = Math.sqrt(w * w + h * h); w *= size / l; h *= size / l; var s = Math.sin(sharpness); var c = Math.cos(sharpness); line(x1, y1, x2, y2); line(x2, y2, x2 - w * c - s * h, y2 + w * s - h * c); line(x2, y2, x2 - w * c + s * h, y2 - w * s - h * c); } function drawlines(target) { var lines = target.createEmptyMovieClip(line_mc, 1); with (lines) { lineStyle(1, 0xff, 100); line(145, 25,192, 88); arrow(100, 100, 300, 300, 10, 0.4); } } ]] /mx:Script /mx:Application Hello, You had several errors in your script, try this variant: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml; mx:Panel width=732 title=MyPanel mx:Canvas id =mycanvas width=715 height=408 backgroundColor=#FF initialize=drawlines(event.target) /mx:Canvas /mx:Panel mx:Script ![CDATA[ function line(x1, y1, x2, y2) { trace(func line); } function arrow(x1, y1, x2, y2, size) { trace(func arrow); } function drawlines(target) { var lines = target.createEmptyMovieClip(line_mc, 1); with (lines) { lineStyle(1, 0xff, 100); line(145, 25,192, 88); arrow(100, 100, 300, 300, 10, 0.4); } } ]] /mx:Script /mx:Application Best regards Stanislav On 8/23/05, Prasad Dhananjaya [EMAIL PROTECTED] wrote: Hi All, I have a small question. I want to call function line() and function arrow() from function drawlinesArrows(). I tried sevaral ways. But failed. Can someone tell me how to do this? Best Regards, Prasad (Absolute beginner of Flex ActionScript) ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml; mx:Panel width=732 title=MyPanel mx:Canvas id =mycanvas width=715 height=408 backgroundColor=#FF initialize=drawlinesArrows(event.target) /mx:Canvas /mx:Panel mx:Script ![CDATA[ function line(x1, y1, x2, y2) { moveTo(x1, y1); lineTo(x2, y2); } function arrow(x1, y1, x2, y2, size) { . } function drawlinesArrows(target) { var lines = target.createEmptyMovieClip(line_mc, 1); with (lines) { lineStyle(1, 0xff, 100); //★below two lines are not working line(145, 25,192, 88); arrow(100, 100, 300, 300, 10, 0.4); } } ]] /mx:Script /mx:Application -- 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 Yahoo! Groups Sponsor ~-- font face=arial size=-1a href=http://us.ard.yahoo.com/SIG=12hfnekk3/M=362335.6886445.7839731.1510227/D=groups/S=1705007207:TM/Y=YAHOO/EXP=1124798733/A=2894361/R=0/SIG=13jmebhbo/*http://www.networkforgood.org/topics/education/digitaldivide/?source=YAHOOcmpgn=GRPRTP=http://groups.yahoo.com/;In low income neighborhoods, 84% do not own computers. At Network for Good, help bridge the Digital Divide!/a./font ~- -- 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/
[flexcoders] About Context menu
Hi, I want to display context menu only inside the canves area. But this code displays context menu in the whole application. I think the problum is this[menu] part. Which means the whole application. But I don't know how to specify canves area.Is it possible to display only in the canvas area? Thanks, Prasad (Absolute beginner of Flex ActionScript) --- ?xml version=1.0 encoding=utf-8? mx:Application initialize=setupContext() backgroundColor=#FF xmlns:mx=http://www.macromedia.com/2003/mxml; mx:Panel width=318 height=247 mx:Canvas id=MyCanves width=296 height=200 backgroundColor=#FF /mx:Canvas /mx:Panel mx:Script public var mnuContext:ContextMenu = null; public function handleContext( obj, item ):Void { } public function setupContext( Void ):Void { mnuContext = new ContextMenu(); mnuContext.hideBuiltInItems(); mnuContext.customItems.push( new ContextMenuItem(menu1, handleContext ) ); mnuContext.customItems.push( new ContextMenuItem(menu2, handleContext ) ); this[menu] = mnuContext; } /mx:Script /mx:Application Yahoo! Groups Sponsor ~-- font face=arial size=-1a href=http://us.ard.yahoo.com/SIG=12hnd5l2o/M=362131.6882499.7825260.1510227/D=groups/S=1705007207:TM/Y=YAHOO/EXP=1124802462/A=2889191/R=0/SIG=10r90krvo/*http://www.thebeehive.org Get Bzzzy! (real tools to help you find a job) Welcome to the Sweet Life - brought to you by One Economy/a./font ~- -- 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/
[flexcoders] Using ContextMenu
Hi All, I want to display right-click context menu only in the canves area. Can someone please tell me how to do this?. My code displays context menu in the whole application. Not only canves area. Thanks, Prasad --- ?xml version=1.0 encoding=utf-8? mx:Application initialize=setupContext() backgroundColor=#FF xmlns:mx=http://www.macromedia.com/2003/mxml; mx:Panel width=318 height=247 mx:Canvas id=MyCanves width=296 height=200 backgroundColor=#FF /mx:Canvas /mx:Panel mx:Script public var mnuContext:ContextMenu = null; public function handleContext( obj, item ):Void { } public function setupContext( Void ):Void { mnuContext = new ContextMenu(); mnuContext.hideBuiltInItems(); mnuContext.customItems.push( new ContextMenuItem(menu1, handleContext ) ); mnuContext.customItems.push( new ContextMenuItem(menu2, handleContext ) ); this[menu] = mnuContext; } /mx:Script /mx:Application Yahoo! Groups Sponsor ~-- font face=arial size=-1a href=http://us.ard.yahoo.com/SIG=12ho72bnr/M=362131.6882499.7825260.1510227/D=groups/S=1705007207:TM/Y=YAHOO/EXP=1124859373/A=2889191/R=0/SIG=10r90krvo/*http://www.thebeehive.org Get Bzzzy! (real tools to help you find a job) Welcome to the Sweet Life - brought to you by One Economy/a./font ~- -- 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/
[flexcoders] How to draw a Trangle??
Hello all, Can someone tell me how to draw a triangle. I started to use Flex Actionscript from yesterday. So less experience knowledge. There is a sample code(only a part) in Flex [help].But don't know how to define triangle_mc(see code)? Is there any other errors in this code? Please help... Best regards, Prasad -- ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml; initialize=drawSqure() mx:Script ![CDATA[ function drawSqure() { this.createEmptyMovieClip(triangle_mc, 1); triangle_mc.lineStyle(5, 0xff00ff, 100); triangle_mc.moveTo(200, 200); triangle_mc.lineTo(300, 300); triangle_mc.lineTo(100, 300); triangle_mc.lineTo(200, 200); } ]] /mx:Script /mx:Application --- Yahoo! Groups Sponsor ~-- font face=arial size=-1a href=http://us.ard.yahoo.com/SIG=12hurcfbl/M=362335.6886445.7839731.1510227/D=groups/S=1705007207:TM/Y=YAHOO/EXP=1124364366/A=2894361/R=0/SIG=13jmebhbo/*http://www.networkforgood.org/topics/education/digitaldivide/?source=YAHOOcmpgn=GRPRTP=http://groups.yahoo.com/;In low income neighborhoods, 84% do not own computers. At Network for Good, help bridge the Digital Divide!/a./font ~- -- 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/
[flexcoders] How to draw a line on the canves which is in the panel?
Dear all, I want to draw some lines on the canves. Location of canves is inside the panel.Without canvas panel tags it works. (But if I set backgroundColor it didn't appear) I tried to get some hint from manual.But failed. Can someone please tell me how to draw a line on the canves which is in the panel, with setting of backgroundColor. Thanks Prasad ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml; mx:Panel width=432 title=MyPanel mx:Canvas width=415 height=208 backgroundColor=#FF initialize=drawlines() visible=true /mx:Canvas /mx:Panel mx:Script ![CDATA[ function drawlines() { var lines = this.createEmptyMovieClip(line_mc, 1); with (lines) { lineStyle(5, 0xff, 100); moveTo(350, 100); lineTo(400, 120); } } ]] /mx:Script /mx:Application Yahoo! Groups Sponsor ~-- font face=arial size=-1a href=http://us.ard.yahoo.com/SIG=12h3fha2b/M=362335.6886445.7839731.1510227/D=groups/S=1705007207:TM/Y=YAHOO/EXP=1124422020/A=2894361/R=0/SIG=13jmebhbo/*http://www.networkforgood.org/topics/education/digitaldivide/?source=YAHOOcmpgn=GRPRTP=http://groups.yahoo.com/;In low income neighborhoods, 84% do not own computers. At Network for Good, help bridge the Digital Divide!/a./font ~- -- 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/