Newbie Needs Help - trying to learn AS3


hey everyone, please forgive ignorance, i'm having trouble getting somethings work.

i've done work actionscript 2.0 in flash, , taking steps learn actionscript 3.0 flex.

one exercise i've been working on book , online tutorial works when placed in timeline on flash ide, i'm having trouble in flex either importing/referencing .as file or having in body of mxml file.

here code:


------------on flash timeline _------------------------------------------------

// create line 100,200 150,250
this.graphics.linestyle(2,0x000000);
this.graphics.moveto(100,200);
this.graphics.lineto(150,250);

// create curve , line
this.graphics.curveto(200,300,250,250);
this.graphics.lineto(300,200);

// draw 2 rectangles
this.graphics.drawrect(50,50,300,250);
this.graphics.drawroundrect(40,40,320,270,25,25);

// circle , ellipse
this.graphics.drawcircle(150,100,20);
this.graphics.drawellipse(180,150,40,70);

// draw filled circle
this.graphics.beginfill(0x333333);
this.graphics.drawcircle(250,100,20);
this.graphics.endfill();


this works in flash ide.



-----------------in mxml file --------------------------------------------------------

<?xml version="1.0" encoding="utf-8"?>
<mx:application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">

<mx:script>
<![cdata[


// first refer this, in stage, draw graphics on stage , set line style
// black 2 px thick line.
smiley.graphics.linestyle(2,0x000000);

// draw circle, outer of head shape, , give yellow fill, because smiley.
smiley.beginfill(0xf0ff00);

// specify x , y position circle , radius tell how big should be.
smiley.graphics.drawcircle(200,180,140);

// tell flash stop drawing , find starting point draw line.
smiley.graphics.moveto(100,200);
smiley.graphics.lineto(150,250);

// create curve , line mouth part of smiley
smiley.graphics.curveto(200,300,250,250);
smiley.graphics.lineto(300,200);

// draw 2 filled (black) circles eyes finish our smiley face.
smiley.graphics.beginfill(0x000000);
smiley.graphics.drawcircle(250,100,20);
smiley.graphics.drawcircle(150,100,20);
smiley.graphics.endfill();



]]>
</mx:script>

</mx:application>


in case error 1120 access of undefined property. i've tried cose .as , in cdata in mxml file. i've gotten errors packages can not embeded.

can set me in right direction i'm doing wrong?

thanks

chuck!

1. how running mxml file?
2. references class called smiley , don't import class. in default package?


More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

Convierte tu Raspberry en un NAS. Firmware fvdw-sl 15.3 - Raspberry Pi Forums

How to format a Get Request

avrdude: verification error, first mismatch at byte 0x0000 0x0c != 0x62