Learning English Online, Free English Lessons For Everyone
_Sponsors_
___ ______

Flash CS3: Lesson 1: Basics lesson about Drag-and-Drop in Flash CS3 PDF  | Print |  E-mail
Wednesday, 13 April 2011 15:46

Flash CS3: Lesson 1:  Basics lesson about Drag-and-Drop in Flash CS3

To illustrate drag-and-drop in ActionScript 3, we will first make some simple applications that involve dragging a circle on a rectangular board.

Each of the following examples have the following common code to draw a rectangular board on the stage and then add a circle as a child of the board. It might seem counterintuitive to build the relationships between myPoint, board, and stage before the graphics are added, but doing all of the "addChild" calls up front assures that the layering of the objects is exactly what we want. (The relationship between the board and the circle, though natural, can cause some issues with mouse events as we will see in a later tutorial.) Both of our objects are Sprites, with the "board" visually represented by a gray rectangle and the "myPoint" represented by a blue circle that is fairly large to illustrate some issues.

// Part 1 -- Setting up the objects

var board:Sprite = new Sprite();

var myPoint:Sprite = new Sprite();

 

this.addChild(board);

board.addChild(myPoint);

 

board.graphics.lineStyle(1,0);

board.graphics.beginFill(0xCCCCCC);

board.graphics.drawRect(0,0,400,300);

board.graphics.endFill();

board.x = 10;

board.y = 10;

 

myPoint.graphics.lineStyle(1,0);

myPoint.graphics.beginFill(0x0000FF,0.7);

myPoint.graphics.drawCircle(0,0,20);

myPoint.graphics.endFill();

myPoint.x = 50;

myPoint.y = 50;

__Please, Click here to have another Lesson about Drag-and-Drop in Flash CS3____

Last Updated on Wednesday, 13 April 2011 16:03
  ________


_____
We have 25 guests online

If you don't see anything in the middle of this page, you may need the latest Flash plug-in.
It only takes a few moments to
Download it FREE at Adobe.com. get adobe Flash player

Teaching English For Kids In Primary School

Stydying English Online For Everyone

Game for Kids


Home || Misterduncan|| Flash Cards || Songs For Kids|| Free Games || Learn English with GOGO|| Teaching English For Childern|| ESL/EFL Kids Course ||
Designed by Learning English Online. Designed by: Free Joomla Theme, mysql. Valid XHTML and CSS.