What you are doing actualy is draw a line on the Application container, not on the canvas, because the function resides on the Application level, and you use the word 'this' to create your movieClip.
 
You could pass a reference to the canvas to your function:
initialize="drawlines(event.target)"
 
then use it in your function:
function drawlines(target) {
            var lines = target.createEmptyMovieClip("line_mc", 1);
 
Cheers
 
Philippe Maegerman
Web developer
+32 2 400 40 39
+32 472 35 28 10
Avoir des rêves, c'est continuer d'exister...
 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Prasad Dhananjaya
Sent: vendredi 19 août 2005 3:15
To: FlexML
Subject: [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="#CCCCFF"  initialize="drawlines()" visible="true">
          </mx:Canvas>
</mx:Panel>
<mx:Script>
<![CDATA[
      function drawlines() {
            var lines = this.createEmptyMovieClip("line_mc", 1);
            with (lines) {
            lineStyle(5, 0xff0000, 100);
            moveTo(350, 100);
            lineTo(400, 120);
      }
}
]]>
</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




SPONSORED LINKS
Computer software testing Macromedia flex Development
Software developer


YAHOO! GROUPS LINKS




------------------------------------------------------------------
**STATEMENT OF CONFIDENTIALITY**

This e-mail and any attached files are confidential and intended solely for the use of the individual to whom it is addressed. If you have received this email in error please send it back to the person that sent it to you. Any views or opinions presented are solely those of author and do not necessarily represent those the Emakina Company. Unauthorized publication, use, dissemination, forwarding, printing or copying of this email and its associated attachments is strictly prohibited.

We also inform you that we have checked that this message does not contain any virus but we decline any responsability in case of any damage caused by an a non detected virus.
------------------------------------------------------------------

Reply via email to