Try this:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">
<mx:Script>
<![CDATA[
function drawDots(event){
var xx:Number=35;
var yy:Number=35;
//var ref_mc = Canves1.createEmptyObject("square",
this.getNextHighestDepth());
var ref_mc = Canves1.createChild(mx.containers.Canvas,
undefined,{percentWidth:100, percentHeight:100});
for (var i:Number=0;i<=15;i++){
ref_mc.fillRect(xx, yy, xx+5, yy+5, 0x000000, 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>
I need to investigate to find out why your approach is not working.
-abdul
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Prasad Dhananjaya
Sent: Friday, September 02, 2005 11:50 AM
To: FlexML
Subject: [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.jpg"is 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, 0x000000, 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>
------------------------------------------------------------------------
-----
--
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 --------------------~-->
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/