Excellent Abdul! I see that I was missing my reference to square_mc.
Thanks for the help.
-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]
Behalf Of Abdul Qabiz
Sent: Thursday, May 19, 2005 12:25 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Flash Drawing API in Flex
Hi,
You can use drawing API in flex also. Yes you can do this with Canvas
because it's only container that supports absolute layouting.
Following is simple example:
##DrawingOnCanvas.mxml##
mx:Application width=800 height=600
xmlns:mx=http://www.macromedia.com/2003/mxml;
mx:Script
![CDATA[
var squareCount:Number = 0;
function createSquare()
{
var square_mc:MovieClip;
++squareCount;
square_mc = cvs.createEmptyMovieClip(square_mc + squareCount,
squareCount);
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 = Math.random()*200;
square_mc._y = Math.random()*200;
}
]]
/mx:Script
mx:Canvas id=cvs width=600 height=400
borderStyle=solid/mx:Canvas
mx:Button label=Create Square click=createSquare()/
/mx:Application
Above code looks too low level, but in Flex you can create custom components
and wrap low-level detailsInfact Flex provide better work-flow..
Hope that helps..
-abdul
-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Dennis Baldwin
Sent: Thursday, May 19, 2005 9:44 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Flash Drawing API in Flex
Hi,
I'm wondering if it's possible to utilize the Flash drawing API in Flex.
Our current Flash application has a tree with drag/drop functionality.
Items are dragged from the tree and then dropped onto a floor plan. In
Flash we trigger an event that draws a box and other shapes on the canvas.
We dynamically create a movieclip and then draw in it:
this.createEmptyMovieClip(square_mc, 1);
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();
How can this be implemented in Flex? I know there are other approaches we
can take but I'm curious to know if there's support for more custom stuff,
ie dynamically creating movies and drawing in them. I was assuming that I
could perform this type of interactivity with the Canvas container, but have
been unsuccessful.
Thanks,
Dennis
Yahoo! Groups Links
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 the Yahoo! Terms of Service.
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/