Draw A Grid
Hi,
i know how to draw a grid using graphics methods but unfotunately, i'm not about to see it if i want to draw it on a particular movieclip.
on the stage it works perfectly.
what should i do ?
here is the code :
Code:
DrawGrid(); trace("line drew");
function DrawGrid():void { var row:int = 8; var column:int = 15; var i:int; var j:int;
for(i=0;i<row;i++) { MovieClip(iPhoto).graphics.lineStyle(1,0xffffff,0.3); MovieClip(iPhoto).graphics.moveTo(0,i*40); MovieClip(iPhoto).graphics.lineTo(600,i*40); } for(j=0;j<column;j++) { MovieClip(iPhoto).graphics.lineStyle(1,0xffffff,0.3); MovieClip(iPhoto).graphics.moveTo(j*40, 0); MovieClip(iPhoto).graphics.lineTo(j*40,320); } } iPhoto is a movieclip that has 5 keyframes and on each a different photo. so each 5 second it changes keyframe value to show it on the stage.
thanks a lot, A.
FlashKit > Flash Help > Actionscript 3.0
Posted on: 03-01-2008, 07:10 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Can't Draw A Grid
I can manage this in other drawing applications, why not Flash? My issue is that I can't draw a grid:
Code:
// With an 800x600 movie this freezes
var step = 10;
lineStyle(1, 0x000000);
for(var y = 0; y < Stage.height; y+=step){
for(var x = 0; x < Stage.width; x+=step){
moveTo(0, y);
lineTo(Stage.width, y);
moveTo(x, 0);
lineTo(x, Stage.height);
}
}
Flash is handling the whole thing very inefficiently, is there a way round this? (Seems that I shouldn't be able to do this faster in Java, but I can.)
Draw A Grid
Hi,
i know how to draw a grid using graphics methods but unfotunately, i'm not about to see it if i want to draw it on a particular movieclip.
on the stage it works perfectly.
what should i do ?
here is the code :
Code:
DrawGrid();
trace("line drew");
function DrawGrid():void
{
var row:int = 8;
var column:int = 15;
var i:int;
var j:int;
for(i=0;i<row;i++)
{
MovieClip(iPhoto).graphics.lineStyle(1,0xffffff,0.3);
MovieClip(iPhoto).graphics.moveTo(0,i*40);
MovieClip(iPhoto).graphics.lineTo(600,i*40);
}
for(j=0;j<column;j++)
{
MovieClip(iPhoto).graphics.lineStyle(1,0xffffff,0.3);
MovieClip(iPhoto).graphics.moveTo(j*40, 0);
MovieClip(iPhoto).graphics.lineTo(j*40,320);
}
}
iPhoto is a movieclip that has 5 keyframes and on each a different photo.
so each 5 second it changes keyframe value to show it on the stage.
thanks a lot,
A.
Draw A Grid
Hi,
i know how to draw a grid using graphics methods but unfotunately, i'm not about to see it if i want to draw it on a particular movieclip.
on the stage it works perfectly.
what should i do ?
here is the code :
Code:
DrawGrid();
trace("line drew");
function DrawGrid():void
{
var row:int = 8;
var column:int = 15;
var i:int;
var j:int;
for(i=0;i<row;i++)
{
MovieClip(iPhoto).graphics.lineStyle(1,0xffffff,0.3);
MovieClip(iPhoto).graphics.moveTo(0,i*40);
MovieClip(iPhoto).graphics.lineTo(600,i*40);
}
for(j=0;j<column;j++)
{
MovieClip(iPhoto).graphics.lineStyle(1,0xffffff,0.3);
MovieClip(iPhoto).graphics.moveTo(j*40, 0);
MovieClip(iPhoto).graphics.lineTo(j*40,320);
}
}
iPhoto is a movieclip that has 5 keyframes and on each a different photo.
so each 5 second it changes keyframe value to show it on the stage.
thanks a lot,
A.
Question About Creating A Dynamic Grid And Draw API
Hello Flash Kit. I was looking for some help with creating a little something.
What im trying to do is create a grid that i can draw lines that connect each intersecting point.
1. How can I create a dynamic grid that knows each point is its own movie clip
2. How can make the draw API know that it can only draw between 2 points at a time.
3. How can i make the draw API know that it can only draw a line to the closest point around the start point (one grid square away)
small image showing what it is im trying to make it do
Draw A Grid Of Dots Dynamically But Fast
Hi all,
Im trying to draw a large grid of small circles but I think Im going about it the wrong way as its too processor intensive.
The way I have it at the moment is I draw my circle in one package. Then I use the circle class to make a line of dots. then I take that row class and repeat that vertically. the problem is, is that its having to draw each circle on each column on each row. Is there a way of duplicating the dynamically created shape instantly across the grid.
Heres the code:
The circle
Code:
package com.dots.documentClass
{
import flash.display.Shape;
public class DrawDot extends Shape
{
private var _color:uint;
private var _radius:Number;
public function DrawDot ()
{
_color = 0x000000;
_radius = 4;
draw();
}
private function draw():void
{
graphics.beginFill(_color);
graphics.drawCircle( 0, 0, _radius );
graphics.endFill();
}
}
}
The Row
Code:
package com.dots.documentClass
{
import flash.display.Shape;
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.events.TimerEvent;
import flash.utils.Timer;
import com.dots.documentClass.*;
public class DrawRow extends MovieClip
{
var loadTimer:Timer;
var boxContainer:Sprite;
var drawDot: DrawDot;
var i:Number = 0;
var numAcross:Number = 100;
var boxIndex:int = 0;
var startX:Number = 0;
var spacing:Number = 12;
public function DrawRow ()
{
loadTimer = new Timer(1);
loadTimer.addEventListener(TimerEvent.TIMER, loadDots);
loadTimer.start();
}
public function loadDots (event:TimerEvent):void
{
if(i < numAcross){
boxContainer = new Sprite();
drawDot = new DrawDot ();
boxContainer.addChild(drawDot);
addChild(boxContainer);
boxContainer.x = startX;
startX += spacing;
i += 1;
}
}
}
}
The columns
Code:
package com.dots.documentClass
{
import flash.display.Shape;
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.events.TimerEvent;
import flash.utils.Timer;
import com.dots.documentClass.*;
public class DrawColumns extends MovieClip
{
var loadTimer:Timer;
var rowContainer: Sprite;
var drawRow: DrawRow;
var j:Number = 0;
var numDown:Number = 100;
var rowIndex:int = 0;
var startY:Number = 0;
var spacing:Number = 12;
public function Columns ()
{
loadTimer = new Timer(1);
loadTimer.addEventListener(TimerEvent.TIMER, loadRows);
loadTimer.start();
}
public function loadRows (event:TimerEvent):void
{
if(j < numDown){
rowContainer = new Sprite();
drawRow = new DrawRow ();
rowContainer.addChild(drawRow);
addChild(rowContainer);
rowContainer.y = startY;
//boxContainer.y = 0;
startY += spacing;
j += 1;
}
}
}
}
Does anybody know a quicker and better way to achieve this?
Thank you in advance for your help.
Flex Draw Grid Line With Numbering In AS3
hi,
I have some problem with the grid line with numbering just like the graph paper with some numbering on the x & y axis. I have done with the grid in a container(UIComponent size 500 by 500, size can be change anytime). So my problem is that how to do I label the numbering on each grid line on both x & y axis like 10, 20, 30 and so on to the end on x & y axis. I try textfield but the problem is I have to create another textfield for every grid line as the size of the container can change so I trying make dynamic as I don't have to assign the numbering myself.
Code:
private static const DisOriginX:Number = 200;
private static const DisOriginY:Number = 300;
public function gridline():void
{
var size:int = 15;
var borderSize:int = 1;
var rows:Number;
var cols:Number;
var r:int;
var c:int;
var shape:Sprite = new Sprite();
var newLabelX:Number = 0;
var i:int = 0;
//draw grid line
rows = Math.round(container.height / size);
cols = Math.round(container.width / size);
container.height = rows * size;
container.width = cols * size;
for(c=0; c<cols; c++)
{
for(r=0; r<rows; r++)
{
var toX:Number = c * size;
var toY:Number = r * size;
shape.graphics.lineStyle(borderSize);
shape.graphics.drawRect(toX, toY, size, size);
t.text = (DisOriginX/10).toString();
}
}
container.addChild(t);
container.addChild(shape);
}
Good Way To Dragdrop Mc To A Sticky Grid With Grid Cells That Animate.
Is there a way to get mc._dropTarget to recognize a hidden MC it drops on?
I have am trying to drag drop a movie clip item onto a 9 by 6 grid. The user should not see the grid. Each grid cell has a number of properties, including an animation that plays in it depending on what is dropped in it. What is the best way to do this. I came up with two ways:
A. Do the math:
1. Figure out what the drop point x and y values would convert to in the grid to find the grid cell it applies to.
2. Attach a new movie clip animation to that cell's centered x,y point to show something happened there.
B. Fill the grid with Movie Clips:
Use the mc._droptarget to see what grid cell movie clip was dropped on and then change its animated state to show something happened there.
The problem with A is that it is a little slow and cumbersome.
The problem with B is that I can't let the user see the cell movieclips. mc._droptarget only works to detect if a mc was dropped on visible graphic area of another mc as far as I can tell.
I could sure use some help on this. Is there a better way?
- Wade
Grid Thumbnail With Dynamic Grid Lists
After 3 days of browsing and searching any sollution for my problem I decided to ask you directly here. I really like the thumbnail gallery for its simplicity and beauty. But I would like to ad or vertical scroller (I'm unable to find it here too, maybe I'm blind, just I'm more at the end of my seeking options) or a make a grid thumbnails, that will show 2 columns of thumbs and 5 pictures in each columns, then under the 2 columns i would like to ad a sort of arrow or button that if my gallery have more then 10 pictures it will go on the next thumbnail list. I'm not looking for any extra fading effects or special movements. Just would love to have a single thumbnail grid on side, with option to have lists of thumbnails by 10 if there is more then 10 pictures or so. If somebody can please redirect me or help me I would be very happy, also other ppl here that are seeking for the similar. thank you
Help With Accessing Grid Spaces In A Grid
Hi Guys
I need a bit of help with my coding. I'm building a small editor that allows users to place electrical components onto a grid so that they can see how electricity works. I have built a grid using an array and for loops and attach movieclips dynamically to that grid. What I want the moviclips to do is to look in the four spaces either side of itself i.e. up, down, left and right. I have managed to pull the grid coordinates out of the grid which enables me to tell the clip which grid space to look at but have been unable to successfully get the code to work.
Here is my code:
myGrid = [[1,1,1,1,1,1,1,1],
[1,0,0,0,0,0,0,1],
[1,0,0,0,0,0,0,1],
[1,0,0,0,0,0,0,1],
[1,0,0,0,0,0,0,1],
[1,0,0,0,0,0,0,1],
[1,0,0,0,0,0,0,1],
[1,1,1,1,1,1,1,1]];
var board:Object=new Object();
board.tileWidth = 30;
board.tileHeight = 30;
board.depth = 1;
board.path = this.grid;
function buildGrid(map){
var mapWidth = map[0].length;
var mapHeight = map.length;
for (var j:Number = 0; j<mapHeight; ++j){
for (var i:Number = 0; i<mapWidth; ++i){
var Tilename:String = "cell"+j+"_"+i;
var x:Number = i*board.tileWidth;
var y:Number = j*board.tileHeight;
var type:Number = map[j][i];
board.path.attachMovie("tile", Tilename, ++board.depth);
switch(type){
case 0:
board.path[Tilename].dropable = true;
break;
case 1:
board.path[Tilename].dropable = false;
break;
}
board.path[Tilename]._x = x;
board.path[Tilename]._y = y;
board.path[Tilename].gotoAndStop((type+1));
//trace(board.path);
//trace (i);
var depth:Number = 2001;
power.onPress = function(){
this.startDrag();
}
power.onRelease = function(){
this.stopDrag();
trace("drop - "+this._droptarget);
var drop_target = eval(this._droptarget);
if (drop_target != null){
if (drop_target.dropable ==true){
//drop_target.gotoAndStop("topsource");
trace("drop on tiles");
trace("we are dropped!");
this._x = 250;
this._y = 60;
_root.board.path.attachMovie("powersource2_mc", "powersource", depth);
_root.board.path.powersource._x = drop_target._x;
_root.board.path.powersource._y = drop_target._y;
_root.board.path.powersource.onPress = function(){
_root.board.path.powersource.startDrag();
_root.board.path.powersource.swapDepths (2001);
}
_root.board.path.powersource.onRelease = function(){
//this code gets the grid/cell/i_j reference and converts it to numbers that
//gives the x and y position within the array
var gridPos = this._droptarget;
var xcellRef = gridPos.substring (12);
var ycellRef = gridPos.substring (10, 11);
//these variables turn the string values into numbers
var Gridx:Number = xcellRef - 0;
var Gridy:Number = ycellRef - 0;
trace ("current x position is::" +Gridx);
//trace ("curent y position is ::" +Gridy);
//var gridCheck:Number = Gridx+1;//check to the right
//trace ("the square on my right is::" +gridCheck);
if (Gridx+1 == _root.board.path.brightlamp){
trace ("something is there!");
}else{
trace ("nope nothing here!");
}
snapto=30;
_root.board.path.powersource._rotation += 90;
Newx = Math.round(_root.board.path.powersource._x/snapto)*snapto;
Newy = Math.round(_root.board.path.powersource._y/snapto)*snapto;
_root.board.path.powersource._x = Newx;
_root.board.path.powersource._y = Newy;
stopDrag();
}
}else{
this._x = 250;
this._y=60;
}
}
}
}
}
}
buildGrid(myGrid);
sorry about the long post but any help will be greatly appreciated!
Tegalad
Grid Marker Not Data-grid
Hi Geeks!
Curious to know if its possible to created grid like marker over an image within Flash?
Have a look at attached image
How To Draw Premieter Of MC? (using Draw Api)
Hi im trying to work out the perimeter of my mc visually, so I want to be able to draw the perimeter of the mc. I gathere there is use of getBOunds and the lineTo and moveTo methods, but how to use them to draw the boundary im not sure. Can any one help?
Grid Equations | Convert Array To Grid, And X/y To Array Pos
Grids? inside Grids? What?!
So recently I have been getting into grids for interactivity solutions surrounding drag/drop of movieClips. Without doing any internet searching (good/bad?) I sat down with a pad and pen and tried to calculate an equation to help control the code for a couple reasons.
First; I had been using something to increment the rows and columns which let the columns determine when a new row would start. This is messy and just bloats the code.
Code:
(not actual code)
for ( var i = 0; i < len; i++ )
{
if( column > totalcolumns )
{
column = 0;
row++;
}
else
{
column++;
}
xPos = column * columnSpace;
}
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
[converts array of items to grid positions]
1 . 2 . 3 . 4 . 5
6 . 7 . 8 . 9 . 10
11. 12. 13. 14. 15
Second; I wanted to determine where a drop occurred in a grid without doing hitTests on more than one item and trying to rationalize < > positions. So I ended up writing out a bunch of numbers, looking at the remainders and eventually leveraging % . (which I later found out is what everyone else probably uses ? the easy way). But how can I make the grid react to my [ _xmouse , _ymouse ] position when dragging an item?
Code:
(actual code)
var newY = Math.floor( i / cols ) * ySpace;
var newX = ( i % cols ) * xSpace;
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
[converts array of items to grid positions ( with less code ) ]
1 . 2 . 3 . 4 . 5
6 . 7 . 8 . 9 . 10
11. 12. 13. 14. 15
To solve the second problem I worked backwards and was able to write a way based on [x,y] that finds a position in a grid array and splices my drag item right inside to temporarily resort on the fly. So onMouseMove it looks like all the items adjust to the item I am dragging when over it's future position in the current grid.
To get the position, it looked something like;
Code:
function getGridPos ( newX, newY, array, cols, startX, startY, xSpace, ySpace)
{
var len = array.length;
// max bounds
var xMaxPosition = cols * xSpace + startX;
var yMaxPosition = Math.floor( len / cols ) * ySpace + startY;
// percentage of width/height
var xpos = ( ( xMaxPosition - startX ) / xSpace );
var ypos = ( ( yMaxPosition - startY ) / ySpace );
// convert to position in array
var xposProduct = Math.floor( ypos ) * cols
var yposProduct = Math.floor( xpos );
// position in array
var newPos = xposProduct + yposProduct;
return newPos;
}
// get array position from x,y
var arrayPosition = getGridPos ( _xmouse, _ymouse , tempArray, cols, startX, startY, xSpace, ySpace );
// put inside temp array
tempArray.splice( arrayPosition , 0 , my_mc );
// sort new items
arrayGridSort( tempArray, cols, startX, startY, xSpace, ySpace );
[p = mouse position ]
1 . 2 . 3 . 4 . 5
6 . 7 p8 . 9 . 10
11. 12. 13. 14. 15
[converts x/y position (p) to an array position]
[1,2,3,4,5,6,7, p, 8,9,10,11,12,13,14,15]
[resulting grid resort ]
1 . 2 . 3 . 4 . 5
6 . 7 . p . 8 . 9
10. 11. 12. 13. 14
15
So this works great. I?m able to know exactly where a point converts to an array position which helped me build a class for all future projects, GREAT 2.0! Now I can have a grid resorting when I just drag over and and the array position is known before I drop the item I'm holding - with drastically less code than I had been using previously!
HERE IS THE PROBLEM / CHALLENGE
So for complication sake (and this is more of a challenge than a problem ) what if I want to do the same thing but make groupings? Like, for every 2 columns - items space out 50 extra pixels and likewise for the y values? I understand how to make that function one way, but I have no idea on how to convert that back into an array position as I have been using in the previous example.
Code:
[ colGroups of 2 , colSpacing of 100 ]
1 . 2 . . . . . . 3 . 4 . . . . . . . 5 .6
7 . 8 . . . . . . 9 .10 . . . . . . .11.12
. . . . . . . . . . . . . . . . . . . . . .
13.14 . . . . . 15.16 . . . . .. . p17.18
19.20 . . . . . 21.22 . . . . . . 23.34
Now it?s easy to make that go one way;
Code:
// original xGrid equation
var newX = (i % cols) * xSpace;
// additional xGrid Groupings equation
var xGroups = 2;
var xGroupSpace = 100;
newX += Math.floor( (i % cols) / xGroups ) * xGroupSpace;
And While that is all said and dandy? What the heck is the reverse of that function to put it back into array form? The problem is just that my current reverse equation really only works on the percentage of the width/height - and that does not take segments into consideration. (solution: bezier hybrid maybe?)
So anybody a math whiz out there? Can I get a little Penner help? I don't need this done ASAP but it would be cool to not have to look back on this problem again.
Thanks!!
I Can't Draw
I've recently purchased flash 5 and I've pretty much got all of the scripting and what not figured out. But I'm having trouble with !!!!!DRAWING!!!!! it's the stupid mouse I'm not coordinated enough to draw with it. Does anybody out there know any software or hardware compatible with flash that will make it more like REAL drawing? instead of trying to draw with mouse.
Thanks
HELP ME PLEASE I NEED SOMEONE THAT CAN DRAW
can someone help me i need someone to draw me two street or modified cars that is all i need please someone help me ill make them a banner or something thanx
e-mail-- LPLinkinPrk@aol.com
Aim- LPLinkinPrk
Draw
I have a simple line drawing tool.
Click, it places a root, and a line follows the mouse until the mouse is clicked again at the end point.
After the line has been placed and created:
How can I make it so that the user can click on the line, (so I can allow color change, width change, etc.)
any ideas would be wonderful! thanks
Can't Draw
hello, this is my first time on the forum and somehow I closed the menu bar that allows me to change the color, writing tool, and access of the lasso.Now I can't draw at all, and I was wondering if anybody can tell me how to bring it back up.
-thanks in advance
Mc Draw
I'm a newbie to this. I really need some help. I'm trying to use mc Draw to make a rectangle. I want it to scale depending on what the user enters in the width and length text box. When they hit enter it draws the rectangle.
Can anyone help? the more I work on this the more confused I get....
Thanks in advance.
Draw A Arc
Hi,
i have a knob/dail which you can turn by draging a handle. i can get the degrees and the percentage from the dail, as i have a listener setup to monitor its position.
so...
heres what i want to do; using the the degrees var i want to be able to draw out a circle (or rather outline my dial) so if for example the dial is dragged to 180 degrees the arch reaches to 180 degrees.
does this make sense?
cheers,
Gareth
[CS3, AS2] Draw()
Can someone help me out with this please?
I have a graphic symbol which is on first frame of "framefile.swf".
And, I have the below code on the first frame of my "main.swf"
Code:
stop();
import flash.display.BitmapData;
var newclip = this.createEmptyMovieClip("newclip", 1);
var empt = this.createEmptyMovieClip("empt", 2);
function bmpFunction() {
var bmpdata = new BitmapData(empt._width, empt._height, true, 0x00000000);
bmpdata.draw(empt.frame_tin);
newclip.attachBitmap(bmpdata,newclip.getNextHighestDepth());
newclip._x=500
}
var xxx = new MovieClipLoader();
var ddd = new Object();
xxx.addListener(ddd);
ddd.onLoadInit = function() {
bmpFunction();
};
xxx.loadClip("framefile.swf",empt);
Below is the screenshot of what i get in "main.swf" when its compiled. The image graphic on the left is the graphic which is there on the first frame of "framefile.swf" which appears fine as per the above code. But its the image that you see on the right that has a problem. Its not getting displayed fully. I am just trying to draw the same image again using bitmapdata.
[CS3] Draw()
Can someone help me out with this please?
I have a graphic symbol which is on first frame of "framefile.swf".
And, I have the below code on the first frame of my "main.swf"
Code:
stop();
import flash.display.BitmapData;
var newclip = this.createEmptyMovieClip("newclip", 1);
var empt = this.createEmptyMovieClip("empt", 2);
function bmpFunction() {
var bmpdata = new BitmapData(empt._width, empt._height, true, 0x00000000);
bmpdata.draw(empt.frame_tin);
newclip.attachBitmap(bmpdata,newclip.getNextHighestDepth());
newclip._x=500
}
var xxx = new MovieClipLoader();
var ddd = new Object();
xxx.addListener(ddd);
ddd.onLoadInit = function() {
bmpFunction();
};
xxx.loadClip("framefile.swf",empt);
Below is the screenshot of what i get in "main.swf" when its compiled. The image graphic on the left is the graphic which is there on the first frame of "framefile.swf" which appears fine as per the above code. But its the image that you see on the right that has a problem. Its not getting displayed fully. I am just trying to draw the same image again using bitmapdata.
Draw On A SWF
Hey guys
i am trying to make a SWF file so that one can select a pen tool and start drawing on the swf file. Does anybody have an idea how can i do that I dont mind scripting anuthing if that can make it work. Any input is appreciated.
thanks all.
How To Draw On JPG
Hello
I am totally new to flash actionscript. I have an image in jpg and it has some shapes ,say a ball. I want the user to be able to draw the ball over it. How can I do this in actionscript. I when I have selected a closed contour I want to tell an application running on another computer, probably on webserver that I have selected a particular shape like in this example a ball.
Is this possible in actionscript.
Thanks
Draw Itself
HELP>>>>>>>>>>>>>>
Does anyone know how make it seem like a shape is drawing itself?
What I really mean is that the effect that makes shapes look like it is filling out the outlines of its shape.
Thank you.
Draw Box
Hello. I have a flash file that draws a box when the user clicks down on the mouse, adjusting the box to any size they need. Here is the code:
Code:
box._visible = false;
box.onMouseDown = function() {
this._x = _root._xmouse;
this._y = _root._ymouse;
this._xscale = this._yscale=0;
this._visible = true;
this.onMouseMove = function() {
this._xscale = _root._xmouse-this._x;
this._yscale = _root._ymouse-this._y;
updateAfterEvent();
};
};
box.onMouseUp = function() {
delete this.onMouseMove;
this._visible = true;
};
This works fine, but I need the user to be able to create multiple boxes. Right now, after drawing a box, then clicking again it erases the existing box. I also need these boxes that are created to attach themselves to a movie clip. I've tried the attachMovie script, but cannot seem to get it to work the way I need it to. Any ideas?
Draw Itself
HELP>>>>>>>>>>>>>>
Does anyone know how make it seem like a shape is drawing itself?
What I really mean is that the effect that makes shapes look like it is filling out the outlines of its shape.
Thank you.
How To Draw A Line
Hi !
I would like some pointers as to how to go about drawing a line. Here's what I want to happen :
I would like the user to click and drag from a point A and a line should begin and end at the point B where the user releases the mouse button.
Any help is highly appreciated.
Thanks in advance
Vinod Sharma
Using Actionscript To Draw
can someone please post some links re: drawing with actionscript using variables and duplicating movie clips....
most of the cool sites (you know who you are!) use this mode of drawing and i would love to find a good tutorial...
thx in advance
Help: Draw & Fill Using AS
Hi all. I'm tring to figure out how to dynamically draw simple shape, such as a square, with actionscripts then fill them. Idealy I would like to beable to set coordinates for the 4 corners so that I could move a corner to morph the shape using code. I dont need dragability, just need to be able to change and fill the shape using AS.
Can anyone point me in the right direction on how to do this in F5 / MX?
Thanks
Draw Instance Name From Within Mc
I am using this code on a checkbox component to draw the instance name of the component back so I can put it to use. But it will only work on components that are placed directly on the stage, it wont pull the instance name from any component in a MC. Any suggestions? Thanks for any help.
Here is the code:
Code:
function noteBtn(component){
trace (component);
}
CreateEmptyMovieClip And Draw
Hi, I am trying to draw a square with 50% transparency with no lines.
I can draw a square and fill it, but I can't get rid of the lines, can anyone help?
m@)
Draw Speed
Is there away to detect how fast the users pc can draw an image/vector or what ever in flash.
The idea being if the computer is slow I can have some features turned off automatically - _quality = "LOW" for exmaple. and vica verca for better computers.
I tring to make a site that will look good on a lot more computers.
cheers
Draw Line
How do you draw lines between different mcs with actionscript
I am using flash 5 but I would be interested in the Mx way as well.
How To Draw An Oval...
How to draw an oval by AS? Not by attaching movieClips directly from library, I tried curveTo but it seems like it doesn't work quite well.
Draw Functions
I've been working on a program which will need to have the user draw on the screen, so I've been working with MX draw functions. I'm having difficulty figuring out what the equation they use for the curve is. I've gathered that you give the end points, and that the anchor point determines the direction of the curve, but what exactly would the equation be, given these three points?
Also, I've noticed that when you are actually drawing with flash, it seems to work differently. When you draw a line, each vertice of the line seems to have a seperate anchor point. What is the equation they use for this, and how does it relate to the one used for the curveTo function?
Thanks for your time, any other details about the draw functions would also be appreciated.
Help Me Draw And Animate
pls help me i cant do ether i whant to learn tho but i whould like some one to personly learn me if they could here is my msm
topbrickforever2003@hotmail.com
Bug With Draw Commands?
I'm not sure if this is my video card driver or not.
So I could appreciate someone taking a look at this.
Just test the movie and see if the draw commands I'm using
creates the same bug I'm getting here.
The fla is a set of class routines for useing the movie clip
drawing commands. Seems when you use multiple beginFill()
and endFill() commands on the same clip odd things start to happen.
Thanks,
Chris
Draw Restrictions?
how do I make draw restrictions, so I cannot draw on the tool bars or other things, exept one display. Check the attachment so you understand better.
-=Thanx=-
Need Someone To Draw For My Shoot Em Up
I need somebody quite good at drawing cartoon style stuff to draw characters/weapons/items/backgrounds for the shooter I plan to make. I know all the actionscript needed to make the game, but I suck at drawing, and I don't want to start without the graphics. If anyone is interested, please email me at tom@wombatman.co.uk
Thanks,
Draw Circle
Hy guys,
I'm still working on my paint-like program and its going pretty wel. Except when it comes to drawing cirkels. Flash came up with the most difficult way ever to draw a circle! What ever happened to just giving the coordinates of the bounding box of the oval? Or center point and radius for a perfect circle?
I've been working on this for three days now. With no result. I know there's a lot about it on the internet but I just can get it to work. Mostly because of the math.
I hate to ask but I've got no choice. Anyone up to creating this peace of code?
Here's what supposed to happen:
The user clicks on the button for drawing circles (I only need perfect circles so that should make it easier)
When he clicks on the stage, a circle should appear with the mouse position where the user clicked as center point and with the radius equal to the distance between the created center point and the current mouse position (I'm afraid this will need the Math.atan() and the Math.acos() functions). While the user drags, the circel should change size according to the mouse position. As the user releases the mousebutton, the current circle is drawn.
To give you a better idea, here's the code I used for drawing a squaire in the exact same way.
if (_global.action == 3) { // tells that user wants to draw a squaire
_root.xbegin = _root.xpos; //xpos & ypos contain the current mouse position. They are updated on every mousemove event
_root.ybegin = _root.ypos; //xbegin & ybegin are the coordinates where the user cliked (onMouseDown)
_root.draw = "rectangle";
onMouseMove = function () { //each time mouse moves, a new squaire is created
_root.createEmptyMovieClip(["clip"+i],i); //everytime user clicks : i++ to create overlapping MC's
_root["clip"+i].lineStyle(1,0xff0000,100);
GetPos.call(); //To get x & y position of the mouse --> then stored in xpos & ypos
_root["clip"+i].beginFill (0x0000ff)
_root["clip"+i].moveTo(_root.xbegin+11, _root.ybegin+10);
_root["clip"+i].lineTo(_root.xbegin+11, _root.ypos+10);
_root["clip"+i].lineTo(_root.xpos+11, _root.ypos+10);
_root["clip"+i].lineTo(_root.xpos+11, _root.ybegin+10);
_root["clip"+i].lineTo(_root.xbegin+11, _root.ybegin+10);
};
onMouseUp=function(){
if (_global.action == 3) {
loadVariablesNum("submitDisplay.cgi",0,"POST"); //send the data
onMouseMove=null; //stop drawing squaires
onMouseMove = function() {
GetPos.call(); //to restart mousetracking
};
}
}
Draw On Image...
Hey,
In need of a solution. I am unbale to get my spray can (mc) to draw on an image (a wall mc). my code so far looks like this...
on the frame:
_root.wall.createEmptyMovieClip("line",1);
_root.wall.line.lineStyle(2, 0x000000, 100);
stop(
on my sray can:
on (press)
{
startDrag(can);
_root.wall.line.moveTo(_x, _y);
_root.onMouseMove = function()
{
_root.wall.line.lineTo(_x, _y);
};
}
on (release)
{
stopDrag();
_root.onMouseMove = null;
}
Can I eventually get my spray can to draw on the wall?
thx for any help.
How To Draw Grass
Does anyone know where I can download a flash file with grass in it or anywhere there is a tutorial to draw grass? I am kind of new with flash and the drawing of it with so many blades, etc. seems too drawn out and plus I find the drawing tool hard to use. Thanks for your help.
Getting Flash To Draw By Itself
I am trying to get Flash MX to draw a spider web. I have Flash creating a empty movie clip
and I have looked into the commands moveTo and curveTo. But how do you get it to slowly draw? I am also having difficulty figuring out how to place my lines where I want them. Thank you.
How To Draw Line?
Hi all,
I have a photo, say of a Printer and I draw the Outline of the Printer, with simple Sketches... just Lines.
Now, how would I create an Animation like Someone is "DRAWING" that lines that make up a Printer???
Hope you get that...
Please help me with that... I do not mean a masking effect.. If I want the Individual Lines to be drawn the way they are... how would I do that..
Thanks a lot for any help that you may provide.
Wishy
Draw Effect... How Do I?
Hi I want FLASH to draw a logo, as If I myself was drawing the outside lines of a logo, any suggestion as to how I do this?
Cheers,
Mads
What Tool Do You Use To Draw?
What tools do most of you usually use when drawing in Flash? Whenever I use the paintbrush, my line are a little jagged, not nice and smooth like on good animation sites such as homestarrunner.com.
Just wondering what tool is most used. Paintbrush or pencil? If paintbrush how did homestarrunner get their lines so smooth? And if pencil, do you use smooth or ink?
Or do you draw in Photoshop?!
Thanks a lot!
Using An Animation To Draw...
i'm using flash mx 2004 pro...
i have a pen that i want to write out whatever i tell it too...similar to this ...i'm just taking a different approach to it...
i have an animation of a pen in flash and i would like it to draw a line or make a mark where ever the tip of the pen is... so basically i'm doing something like my_mc.lineTo(pen._x, pen._y) but that's not working...i've created an empty movie clip, set the lineStyle, etc. ...there's just nothing showing up when the animation runs...maybe you can't do it this way, but i would just like to see what others have to say about this...thank you...
|