ActionScript 1/2 :: Saving Dynamically Drawn As MC?
Dec 7, 2010I seached everywhere and try fo find drawing board code that saves after drawing but it seems it's only applicable in AS3, perhaps anyone have any tutorial link or have
View 2 RepliesI seached everywhere and try fo find drawing board code that saves after drawing but it seems it's only applicable in AS3, perhaps anyone have any tutorial link or have
View 2 RepliesI have been looking for a preloader such as the one at [URL]. The preloader there is just the effect I've been looking for for a long time. I know it's done with scripting, but I could never make it quite right. I even posted here a few times, and found a tutorial, but it used a drag bar to control it, not bytesLoaded. Any tutorials that you could lead me to that focus on making it a preloader
View 14 RepliesIs it possible to use a dynamically drawn line as a mask? (graphics.lineTo...) . Is there a way to cast this as a movieClip? I tried adding it to the movieClip, but that did not work.
View 4 RepliesI am trying to dynamically draw a circle and fill it up with some color. Drawing a circle is pretty easy job for me, but fill it up with some color seems not happening today.
PHP Code:
Circle function starts
function fnDrawArc(mc,x,y,r,angle){
mc.beginFill(0xFF0000); // this is not working....
mc.moveTo(x+r,y);
for(i=1;i<=angle;i++){
[Code] .....
I was just conducting a little experiment, basically trying to come up with a stage resizing handler that would position everything on the stage with its x and y proportionate to its original position. That's when I discovered a very interesting thing.
Shapes that you draw using flash's drawing tools are treated completely differently than dynamically drawn shapes. Basically shapes you draw on the stage in the authoring tool would seem to have no x and y of their own, and also no matter how many different shapes you draw, to the compiler it's all one "child" object because it's all just one big shape.
To illustrate this difference, I created two separate files, but they both (seemingly) do essentially the same thing. In the first file, I drew a red circle shape dynamically with code, and set its x and y with code:
ActionScript Code:
var circle:Shape = new Shape();
var g:Graphics = circle.graphics;
g.beginFill(0xFF0000);
[code]...
In a second file, I manually drew a similar red circle shape, made it 100 pixels wide and tall, and positioned it at 100, 100 using the properties panel. This time, I took away the code that creates the circle dynamically and just kept the for loop:
ActionScript Code:
for(var i:int = 0; i < this.numChildren; i++) {
var item:DisplayObject = this.getChildAt(i) as DisplayObject;
trace(item); //[object Shape]
trace(item.x); //0
trace(item.y); //0
}
In this second example, no matter how many and what kinds of shapes you draw, there will only ever be one display child and the x and y is always 0,0.
I for one kind of wish there were more of a one-to-one correspondence between the Flash IDE and the code window. Like, if we can create Shapes and name them dynamically, why can't we create Shapes and name them at authoring time? Or why isn't this now the role of the good ol' Graphics symbol? It's kind of like Flash and Actionscript have outgrown the authoring environment.
This would seem to have the effect of further widening the gap between design and development. Just thought I'd throw all this out there and see what kind of comments I get.
I have a Group on my View, and i'm trying to fill it with some collor and add an mouse event on it, all dynamicaly.the problem is, when i add the mouse event, the group simply turns invisible again. It still exists on the view and responds normally to the mouse event, but i cant see it.here's an code example:
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" title="HomeView" creationComplete="onCreationComplete()" >[code]......
without the mouse event, the group is visible, but it vanishes when i try to add it. i've tried with other events, like the ENTER_FRAME Event and it works normaly, but all the mouse events that i tried turn the Group invisible.i've actually solved my problem using the opaqueBackground property, the Group don't vanish when i add the event this whay. But now i'm curious about the reason of this behavior.
I want to make a dynamically (using Drawing API) drawn ellipse rotate around its axis. It involves a lot of trigonometry which I'm not very good in .
View 7 RepliesI had to create dynamic with AS some rectangular on stage using moveTO and lineTo. I had a button and when I press it should add a new rectangle on stage but it doesn't. Because the array that I am storing the MovieClip created are overriding I guess
var i:Number =0;
button_name.onRelease = function() {
i++;
var instancename:String ="new_mc"+i;
var mcClip:MovieClip=createEmptyMovieClipinstancename,this.getNextHighestDepth);
[Code] .....
I want to make a dynamically (using Drawing API) drawn ellipse rotate around its axis. It involves a lot of trigonometry which I'm not very good in .
View 7 RepliesI'm trying to write a little flex app that has a paint/canvas type feature to draw an image, which I then want to post to a rails server side. I'm following the post here, but can't get as far as he did due to the following error: NoMethodError (undefined method `rewind' for #):I googled that and found this which says the problem is due to an empty filename, but I thought I had that from the example. However, I altered the example to simplify the post by reducing the form parameters, but I could have easily messed something up since I really don't know what I'm doing with this multipart form content. I was hoping to at least log the request params, but unfortunately I can't, since it's failing before being routed and due to my inexperience with rails. I'll ask that in a separate question and hopefully be able to edit this question with the request params.
View 1 RepliesSay I have a webpage where a user enters their name and it is displayed to them on a swf. If I have a save button, how could they save their dynamically changed swf to their computer, with their name on it?
Bare in mind that if a normal save is completed, they will only be saving the swf on my server. Somehow, something needs to happen to get them to save the swf with thei name on it, as saving a dynamic swf is not possible in as3 (I dont think)
I've been using Flash for ages but haven't a clue about backend scripting.I've got a flash app where you can add movieclips to the stage and drag them around etc... ...what I'd like is for the user to dynamically save the _x, _y and _rotation values so they can be viewed by other people.What would be the best way to do this - write to an XML file or to a MySQL database? I've looked at some tutorials but its beyond my capabilities to be honest
View 5 Repliesi've attached my flash file. I don't get why the path is not drawn if the movieclip is set ask mask. I would like to slowly reveal the text.
View 2 Repliespublic class Greeter extends MovieClip
{
public function Greeter()
[code].....
How do you add a drawn object to the stage using actionScript 3? Does the object need to have an instance name?
View 2 RepliesHow can i easily break the shape into two pieces so that I can change them into movie clips?I tried using the selection tool combined with shift key to create selections but the selection tool only does squares so it's very frustrating to select a portion of my drawing precisely using it, i've given up
View 1 RepliesI'm trying to make a program that's meant for graphics tablets in AS3. So far I can allow the user to draw a line across the stage so that they know where their moving their pen around. However I want this line to only be temporary, and so the graphics.Clear() method is called to remove it.
I'd like this to look a lot better however, as the line just instantly disappears. Does anyone know how I could add code that makes the line fade out to 0 alpha first before I call the clear command?
[Code]...
I wrote the following code for drawing a rotate rectangle
var s:UIComponent = new UIComponent();
s.graphics.lineStyle(1, 0x0000FF);
s.graphics.drawRect(50, 50, 200, 200);
s.rotation = 30;
template.addChild(s);
Where template is a canvas. Its rotate nicely but the problem is the position is not in right place. i.e. it is not in (50,50) after rotate.
I want to use numbers I've drawn myself to represent a number, but don't know how to implement this. How would I display the equivalent of an integer with these numbers? If it's necessary to have them in a tile pattern, which makes sense to me considering how older games worked, then what code would I use to switch between each? Or is there another, better way? Also, I need the number to be able to adjust to the number of digits in the number and read from left to right (so the 1 in 10 would be in the same place as the 1 in 1).
View 2 RepliesI'm playing with Open Flash Chart. Take a look at this chart: [URL] As you can see, the rounded dot points look ugly. Some of them are more rounded, some of them less, they don't look the same, as they should. I don't know AS3 and have no idea what is the case. I checked the source code:
[Code]....
I've drawn a button using actionscript as seen in the code below but i do not know how i add text to my button
import flash.events.MouseEvent;
import flash.display.*;
import flash.net.URLRequest;
[code]......
Lets say I have a customMovieClip. I sometimes draw an ellipse with customMovieClip.graphics and sometimes a rectangle. Now I want to know what was the shape ( ellipse/rect) that was created using a particular graphics object. Doing this would enable me to pinpoint what exactly to do with that customMovieClip() instance.
View 3 RepliesIf i draw a movieclip on a frame (root) as such:[code]This will draw a simple square from position 20,20 on root. Now if i trace penName_mc._x i would expect it to give me the distance from the root origin i.e. 20 however it always produces 0. My questions are:
1- Why doesnt it consider x as 20?
2- Is there no way to determine the x of this newly created movieclip from the origin? (besides drawing from 0,0)
How do you resize shapes drawn in actionscript?
I need to create a skewed rectangle and on rollover, have the right edge move outwards.. making the skewed rectangle wider.. while keeping the proportions.[code]...
On mouse move i have a line drawn using lineTo method. This works like in Paint or most drawing programs: the mouse drawing like a pencil. What i need now, and dont know how to accomplish, is to add a number of mclips over that line. And this mclips should be over the line but separated to each other (different x and y of the drawn line). So in the end when moving the mouse the user should get a line and, every certain distance, a number of mclips over it.
View 2 RepliesIs it possible to create 2-3 drawn lines in actionscript?Wanted to make a dynamic chart, but so far when I add coding for the second line, the first no longer works.
Trying to nest the lines in movie clips didn't work.Is this a restriction of the createEmptyMovieClip?I'm using....
_root.createEmptyMovieClip("lineFirst",0);
lineFirst.lineStyle(12,0x000000,100);
lineFirst.moveTo(0,0);
I have an XML file which consists of x/y coordinates...from this I draw shapes in a movieclip on stage when the user chooses(from list component) an xml to load...how do I clear the contents of the mc so that when the user chooses another xml file from the list component the new xml is drawn in the now emptied mc from before??...
View 1 Repliesim trying to work out how to keep lines drawn between different movieclips. It works, but wont clear the lines!!, so i have to leave it out.. to see something .. should I put them all inside an empty movieclip?
[Code]...
I have this triangle drawn (see fla)(Got it from this forum). Now I want a height being drawn as well. I want a height from point A beeing drawn to BC The angle at BC must be 90 degrees of course and the height drawn must alter when I drag the points B and C. Is this possible to do in flash, I have seen it done in JAVA
View 3 RepliesI altered a movie with the following AS:
[Code]...
How can I duplicate this "mask", and place it on a grid. I tried a couple of things, but my "code juggling" didn't work this time... *I left out the function "drawCircle".