Speed
I am viewing a web page from 2 different computers - both have Flash Player 7 installed in IE. Actually Flash Player seems to work better in Firefox than IE, but then again what doesn't?
When I view this file on the 2000 machine (the other one is xp), it plays much too slow, even after the whole file has been downloaded. Is this processor speed? Doesn't make sense as both processors are fast.
FlashKit > Flash Help > Flash General Help
Posted on: 08-21-2004, 04:41 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Streaming Audio Speed No Good - Depends On Processor Or Internet Connection Speed?
we are launching a narrated, streaming flash 6.0 presentation for a client. frame rate is 20fps. here is the link:
http://www.optionaldesigngroup.com/preston
they sent us this email:
"I do not know who else this may be happening with, but when Marjorie Sanders (OC) opened to take the tour, it loaded the software (not sure why her machine didn't have it), and the video was the size of a postcard, Kathleen sounded like a little child (almost munchkin like) and was going 100 mph (so very, very fast - almost unintelligible). Can we experiment with it. Could it be because of the download - I would hope that people don't receive it that way or they will end up laughing at it (it is almost silly)."
does the streaming sync depend on the internet connection or the processor speed? i am assuming processor, and that on a kick-butt new machine it will stream faster then on a slower one.
i think the only way to counter for this is to go in and add some more frames in the narration between phrases. we don't want to lower the framerate because it will affect the flow of the tweens.
any thoughts on this would be greatly appreciated. thanks.
Problems With Speed: Loading An Animation Dynamically...reduced Speed Why? W/exampl
Im loading an animating logo dynamically into a site. The animation works in normal speed if i access it directly:
http://www.ingerreime.no/David/thegl...ches/home.html
But, when i load it dynamically into the main site, the speed reduces drastically! Click "home":
http://www.ingerreime.no/David/thegl...achesmain.html
Everything is loaded dynamically, except the blue backgrounds.
Any thoughts?
Thanx!
Dave
Light Speed Or Warp Speed Effect.
Can someone tell me if they no how to create or have and .fla file of the stars in the star wars when ships go to warp. They kind of strech. I have been looking for this but the search tool here is not the best.
[MX04] MC Speed Vs. Document Speed
I'm an intermediate to flash, and know limited coding.
But,
I have created a flash slideshow with a preloader. However, the preloader needs to be at 12fps in order to look good, but the slideshow is at 0.4fps to look good. (It basically just flips to each image.) The controller is a sample controller in flash, and I wasn't sure how to activate the delay switch in it, so I just set the fps of the whole scene at 0.4fps.
Anyways, is there a way to have the whole slide show at 0.4fps but the preloader MC at 12fps, or sped up or something. Thanks!
How Do I Change Speed The Speed?
Is there a way to change the speed of an object on Mousemove OUTSIDE the movie.
I have to make a small animation (about 6px x 600 px) in the header of a HTML-document with a flash-animation that changes speed when you scroll the mouse over the body of the html-document.
Is this possible?
Niek
Can I Speed This Up ?
Im loading the variable "desc" from a text file which is about 3 paragraphs long and replacing the characters "$A$", "$P$, $E$ with &,=,+ is there any way to speed this process up? Right now its taking a good 20 seconds to process on a P3 900mhz
I'm aware that I can use special character codes such as %26 for "&" and so on but for what we are trying to do it wont work that way.
//-----------------------------------------------------
loadVariables ("test.txt", "");
test = desc;
do{
value = test.indexOf("$A$");
if (value <> "-1"){
test = test.substring(0, value)+"&"+test.substring(value+3, test.length());
}
value = test.indexOf("$E$");
if (value<>"-1") {
test = test.substring(0, value)+"="+test.substring(value+3, test.length());
}
value = test.indexOf("$P$");
if (value<>"-1") {
test = test.substring(0, value)+"+"+test.substring(value+3, test.length());
}
} while (value <> "-1")
//-----------------------------------------------------
CPU Speed
I am designing a Flash site on a Pentium III 500Mhz and when I tested it on a PIII 1.1Ghz, the sounds lost all synchronization with the animations since the animations are much more faster than the sound. When I lowered the frame rate, everything worked fine.
Is there a way through code on how Flash detects the CPU speed and automatically arranges the Frame Rate? Or is there something else I can do so that when exporting my code to a faster CPU, there is no change to my original site?
Thanks
CPU Speed
I am designing a Flash site on a Pentium III 500Mhz and when I tested it on a PIII 1.1Ghz, the sounds lost all synchronization with the animations since the animations are much more faster than the sound. When I lowered the frame rate, everything worked fine.
Is there a way through code on how Flash detects the CPU speed and automatically arranges the Frame Rate? Or is there something else I can do so that when exporting my code to a faster CPU, there is no change to my original site?
Thanks
Speed
I have a 109k swf file, and I have created a preloader and works great in my computer but whenever I check it in another computer graphics play slower and sound just goes on at its normal rate. I know that depending on the power of the computer is how fast is going to play but I think has to be a script that will read the computer capabilities or system speed and then it will play at an assigned frame rate according to the system capabilities. Is this possible or not? or do I have to create 2 versions where one of the movies frame rate is faster than the other so the user can pick one according to their capabilities. Please help or send me a refference where I can go end check this inconvenient that is making me crazy.
Note: All this is being tested on T3 conection.
Getting Up To Speed
I've been playing with Flash a little, but I want to start making more progress. What is the best way to learn how to make eye grabing sites. Classes, books, tutorials? I know it is going to take a good deal of time, I just want to make sure I am heading in the right direction.
How did some of you start, and how did some of these people get so damn good?
Speed Swf Up
Hi, I was wondering is there such code to speed up the swf animation? Thank you.
MC Speed
I posted a message a while back on controlling a mc speed following the mouse,now I have another
I have a button and a mc1
when I mouse over the button I have the mc1 move from its resting spot over to the button and display text for that button.
I have another button with same effect and this is working fine but I would like to slow the rate of speed the mc1 moves to the button I mouseOver
thanks
SWF Speed Help
hi guys just wanna ask how could i make my movie into 50fps or more have trouble and was thinking if it is better if i could use a script for these cuz tried the fps toolbox/window it not working so help me....i'm new to this so could you recommend a script.....
Speed Help
Okay, I was woundering if anyone can tell me how to make my flash website load faster. Plus, tell me about streaming music and will that make it go faster?
Thank you very much.
Speed
Hi There
What is the best way to make an animation or a big jpg animate smoothly. I have noticed that when you animate an opacity change it slows the rest of the movie down, even if I add a loading script at the beginning
Any ideas?
Danny
Speed It Up
If u check out
cirquelemasque
you will see the way the interface moves left or right. I know if i change the base rate it will make it move faster or slower but what cna i do to make it work faster on slower modems. the overall file wiht intro is 570k. the intro is 200k and 370 for movie. I f i seperate them and make an intro for both, wil lit make the movement faster for slower computers.
Also I will accept comments about the site, Its in its final stages and is live, but I am tweaking it
Speed
I've got a general curiousity question: why exactly does Flash run so damn slow?
I've got all sorts of programs on my computer that do things countless times more complex that what my game does, and yet they run at a much greater framerate. How is it that a 2D program chugs along so slowly? Was it a concious decision by someone to limit the amount of processing power Flash gets, or is it just really inefficient?
Speed?
Look i'M probably becomin a pain but i'm tryin for ur flash speed how do u slow it down mine like goes 30 frames in 5 seconds could someone plz tell me how to slow down the speed????
Speed (fps)
Please tell me that can i control the speed of a swf (fps) dynamicaly if yes then how?
Speed
Can I control the speed of a movie dynamically on click of a external button.swf (button to get speed high & low)
Speed Up?
anybody know owhy my movie sorta doubled in speed at the end of the 5th scene, and sped up the other scenes after it?
Speed, Speed, And More Speed - HELP
Hey guys and gals, this is a weird issue I have, I'll try to explain it the best I know how.
Here we go..., I am creating a CD portfolio in Flash and everything is going great. yeah! But I have come across a problem.
I have a main interface which is a swf published as a html file. The user can click on several buttons, these buttons load pictures, videos, and interactive stuff. These files being loaded, are in a seperate folder. I am usin the getURL to well,...get them.
The problem is...It takes forever to load the videos!! Correct me if I'm wrong, but its on a CD, it shouldn't take 2mins to load a video, it should be instantaneous. Its fast when I test it on my hardrive, but not when I test it on my CD!
I need any expert advice you gals and guys may have. please help.
Speed Changes
hi. i've got a shell movie which loads 5 external movies with five buttons.
the first time i press any of these buttons, the movies load and their speed is fine (they're all set at 40fps).
but the second i click a button a 2nd time the speed increases. i'm pretty sure the frame rate cannot increase but i just don't see what i'm not clearing away when i load another movie into my single placeholder.
i was hoping someone might be able to point me in the right direction. i've attached the files.
thanks in advance. fumeng.
SWF Speed
Hi,
I'm making a movie with 4 pictures in (2 png's en 2 gif's 256 colors). The project is 960 by 610. de pictures are also that big. Now I have a frame rate of 30 fps, and when I make 2 pics appear, it's slowing down.
Can someone give me some help because some site have a lot of pictures, and you cant see a thing.
please help me.
kilikMC
MC Speed
Is there a way where I can either slow down or speed up a movie clip. Also how can I maintain the same fps from a movie that is being loaded into another.
Ex.
Main movie is 21 fps
Movie being loaded is 10 fps
I hope I was clear enough. Thanks
Tom
Help With Speed
hi. im quite new to flash mx and i have just been experimenting wih some code. what i am trying to do is create a shape that will move up when the up arrow is pressed. i have created a square and converted to a movie clip and added this code to it
onClipEvent (enterFrame){
if (Key.isDown(Key.UP)){
speed -=10
}
}
when i run the file it does not come up with any problems but when the up key is pressed nothing happens. how can i fix this?
Sterny
Speed
Is there a way of finding out how long the page I have created in Flash will take to uplaod (i.e. whether I need a long preloader) on a website when it is up and running?
Is the preview option in Flash close to how long it will take in "real life"?
CPU Speed. Need Everyone To Help.
I used to have an AMD 2800+ and now I have a Atholon64 3400. Flash runs at a slower frame rate on my 3400 even though it's a faster processor.
Does anyone know of a good flash benchmark system?
Also, what processors do you all have? What ones help flash run at peak performance?
Need More Speed
Can anyone please show me how to speed up this scrolling mc:
i have a long mc which will be full of thumbnails, and it has left and right scroll buttons which move the whole mc left or right. The movie has a frame rate of 60.
The mc and the buttons are all in an mc with these actions on it:
Code:
onClipEvent (enterFrame) {
if (frameCounter%speedFactor == 0) {
if (sliding == "left" && picBar._x>-588) {
picBar._x--;
} else if (sliding == "right" && picBar._x<-382) {
picBar._x++;
}
frameCounter = 0;
}
frameCounter++;
}
Inside that mc there are these actions on the timeline:
Code:
scrolling = 0;
frameCounter = 1;
speedFactor = 1;
The buttons have this code (this is just the left one which is obviously almost identical to the right):
Code:
on (press) {
sliding = "left";
frameCounter = speedFactor;
}
on (release, releaseOutside) {
sliding = 0;
}
Please tell me how to adjust the speed of the scroller, everything i've tried either makes no difference or slows it down.
Speed Changes In Web
I searched the forums for this question, but didn't find any that helped to answer it.
The scenario:
When I make files, they run perfectly fine in 30 fps, in the preview mode.
They work perfectly fine as a .swf running off my pc.
When I upload it to the web, the frame rate drops considerably.
I have tested it on the Safari browser as well, so I know it isn't just my own PC.
Here are the two files, you can see for yourself:
Web version: http://members.cox.net/projecthappy/BDcard.html
.FLA version: http://members.cox.net/projecthappy/BDcard.fla
The point was for the cake to fall right during the 'woop' sound, but its off-sync in the browser version.
I'm having this same problem with any other file I try to put online. Even very basic and small files.
Your help is greatly appreciated!
Speed - Help
Hi I am a teacher and I want to make an educational animation. in my animation I want to contol my movieclip speed by slider. however I could not find such code could you help me about this issue - I am a designer not coder.
thx everybody.
I Want This To Speed Up
it works fine, i just need it to go faster and i cant seem to do it correctly...
PHP Code:
onClipEvent (load) {
this._x = _root.BossGun._x;
this._y = _root.BossGun._y;
this._rotation = ((Math.atan2((_root.ship._y-this._y), (_root.ship._x-this._x)))*180/Math.PI);
}
onClipEvent (enterFrame) {
this._x = this._x+Math.cos(this._rotation*Math.PI/180);
this._y = this._y+Math.sin(this._rotation*Math.PI/180);
Speed Help
Alright I can't seem to figure out how to add random speed to an object can anyone help me out? I just don't seem to understand speed. Thanks
Var Speed
Hi
I am creating a game and i have a health countdown ( a textbox that counts down) when the enemy is touching you. At the moment it falls very quickly. DOes anyone know how i could make it go at a certain speed like loose 1 health for every 1 seconds it touches or something? It would probs have to be a var code but does anyone know it? Here is the code so far:
onClipEvent(enterFrame){
if (hitTest(_root.enemy)==true){
_root.health.text = Number(_root.health.text) - Number(1)
}
}
How would i slow it down???
Speed In As2 And As3
i wasn't sure where to put this as it concerns AS2 and AS3.
The first language i ever learnt was AS2 and i am very proficient in it now. However, i'm working on a game and speed is very important to me.
Do you think it's worth learning AS3 for the speed difference? how difficult is AS3 to learn? and how much faster is it?
is it sufficient to use AS2 on flash player 9?
awaiting a reply,
mattk210
CPU Speed And Fps
hi all.
i'm developping a 3d engine with primitives, local transformations, global transformations, camera, few lights, diffuse + reflect, hidden faces and Zbuffer. with 100 cubes, near the camera, i'm reaching less than 15 fps (about 13). my PC Cpu is working at 1400Mhz.
i'd like to know on which Cpu Speed average, flash programmers are basing their work ? humm not sure it's clear :
with simple words : what is actually the cpu speed average reference for developpers ?
thank you,
dan
[Q] How Would You Speed This Up?
Howdy...
I was about to sleep for tomorrow and I had some thought... So, I have this one... It looks okay, but I think this one is not 'fast' enough as a transition...
Basically I have one image on the stage and have a mask that is composed of multilpe boxes and I am just removing individual movieClips to do this...
Here is the test result...
Code:
// 1 // 5 // 10
1 Interval : // 5551 // 3753 // 3511
2 Interval : // 4392 // 3484 // 3343
3 Interval : // 4040 // 3395 // 3222
4 Interval : // 3889 // 3327 // 3208
5 Interval : // 3716 // 3286 // 3227
6 Interval : // 3652 // 3197 // 3120
7 Interval : // 3634 // 3181 // 3088
8 Interval : // 3563 // 3172 // 3088
9 Interval : // 3546 // 3692 // 3066
What that table means is that if I run five intervals(row) that removes ten grids each time(column), it takes 3227 ms...
Here is the script...
ActionScript Code:
imageW = 350;
imageH = 250;
mcW = 10;
mcH = 10;
loopW = Math.ceil(imageW / mcW);
loopH = Math.ceil(imageH / mcH);
stX = this.image1_mc._x;
stY = this.image1_mc._y;
depth = 1000;
this.createEmptyMovieClip("mask_mc", depth++);
maskMC_arr = new Array();
for (var i = 0 ; i < loopH ; i++)
{
for (var j = 0 ; j < loopW ; j++)
{
var w = (j < 10) ? "0" + j : j;
var h = (i < 10) ? "0" + i : i;
_m = this.mask_mc.attachMovie("MC_Box", "box" + w + "" + h + "_mc", 1000 + depth++, {_x:stX + mcW * w, _y:stY + mcH * h});
maskMC_arr.push(_m._name);
}
}
this.image1_mc.setMask(mask_mc);
this.action_pb.setClickHandler("dissolve");
function dissolve()
{
this.attachMovie("MC_Image2", "image2_mc", this.image1_mc.getDepth() - 1, {_x:this.image1_mc._x, _y:this.image1_mc._y});
this.action_pb._y = 1000;
maxMC = 5;
st = getTimer();
trace("Start Time : " + st);
// 1 // 5 // 10
_i1_iv = setInterval(removeRandom, 1, this, 1); // 5551 // 3753 // 3511
/*
_i2_iv = setInterval(removeRandom, 1, this, 2); // 4392 // 3484 // 3343
_i3_iv = setInterval(removeRandom, 1, this, 3); // 4040 // 3395 // 3222
_i4_iv = setInterval(removeRandom, 1, this, 4); // 3889 // 3327 // 3208
_i5_iv = setInterval(removeRandom, 1, this, 5); // 3716 // 3286 // 3227
_i6_iv = setInterval(removeRandom, 1, this, 6); // 3652 // 3197 // 3120
_i7_iv = setInterval(removeRandom, 1, this, 7); // 3634 // 3181 // 3088
_i8_iv = setInterval(removeRandom, 1, this, 8); // 3563 // 3172 // 3088
_i9_iv = setInterval(removeRandom, 1, this, 9); // 3546 // 3692 // 3066
*/
}
function removeRandom(loc, num)
{
this = loc;
var l = maskMC_arr.length;
if (l > 0)
{
for (var i = 0 ; i < maxMC ; i++)
{
var rnd = Math.floor(Math.random() * l);
// trace("maxMC = " + maxMC);
// trace(maskMC_arr[rnd] + " : " + l);
this.mask_mc[maskMC_arr[rnd]].removeMovieClip();
maskMC_arr.splice(rnd, 1);
}
}
else
{
clearInterval(eval("_i" + num + "_iv"));
ed = getTimer();
trace("End Time : " + ed);
trace("Total Time : " + (ed - st));
trace("Done removing everything... " + "_i" + num + "_iv" + " " + l);
}
}
So, tell me... What is your trick to speed this process???
FLV Speed
Hi all,
how can i slow-down a FLV playback at run time?
I wish to play the same file at half speed pressing a button, I've tried
to set the 'FPS' media property but it seems to not work...
Any advice?
Thanx.
Speed Up XML
Is there any way to request an XML doc then use it in a 'succes' statement later when needed. The reason I have this question is that I have menu that builds itself from this XML doc plus it loads jpgs into each menu item (making use of the moviecliploader class) and there a huge hang time. The combined jpg kg size is about 120 kb, I thought loading the XMl doc earlier would take away some of that hang time. Am I going about this wrong? I realle have a solid (at least I think so) XML statement that does everything I want it to and Im looking not to change it all that much. Maybe preloading the images is a better angle (though I wouldnt know how to go about that).
Edited: 12/21/2006 at 03:44:12 PM by >Vee<
Help For Speed SWF
Hello...
I don't know if I have done good to record this forum of Adobe..
Because i have a small problem the different speed of file SWF public on the web..
Last week i have created a animation with 24 fps on the Macromedia Flash, after created, i have saved SWF, this file it is very speed, but i have inseret this file SWF on the html from Macromedia Dreamweaver, after upload on my site, isn't very speed as before, it is a lot slow!
Why for you?
You can help me for resolve this small problem of speed?
Because, i have visit and see on this site http://spiderman3.sonypictures.com/, this site and this file SWF it is very speed, i don't know why my SWF public on web is slow that this site of SPIDERMAN is very speed?
Thank you very much
Bye bye
cristiano
AS Help With The Speed
Hi guys
I need some with this AS code it is for a typewriter effect. it works well but where in the code can i make it type faster (speed).
Thanks
this.texto = "hola, que tal hermosas?";
this.letraIndex = 0;
this.letras_array = [];
this.typeID = setInterval(this, "escribe", 100);
this.escribe = function(){
var letraAEscribir = this.texto.charAt(this.letraIndex);
//this.letras_array.push(letraAEscribir);
//var textoAEscribir = myString.concat(this.letras_array);
this.textBox.text += letraAEscribir;
this.letraIndex++;
}
How Can I Speed This Up?
I am 1/2 way through a site - but on my computer it is really sluggish,
here
any tips to speed it up?? - There isn`t alot of movement etc -
cheers
John
How Can I Speed This Up?
i was looking at the Complex Button RollOver/RollOut Effects (http://www.kirupa.com/developer/mx20...ton_effect.htm), tried it out and it's working like a champ.... but what i wanted to know is how can i speed up the rewind. instead of going to the previous frame (prevFrame()) how can i tell it to go back every two frames, every five frames, or every ten frames, etc:
Code:
this.onEnterFrame = function(){
if(rewind == true){
prevFrame();
}
}
this.onRollOver = function(){
rewind = false;
play();
}
this.onRollOut = function(){
rewind = true;
}
Max Speed
i have made a swf thats supposed to let you alter the accel and everything but the max speed isnt working. here is the code i used :
onClipEvent (load) {
_root.speed = 0;
_root.maxspeed = 20;
_root.accel = 1;
_root.deccel = .9;
}
onClipEvent (enterFrame) {
_root.speed *= _root.deccel;
_x += _root.speed;
if (Key.isDown(Key.RIGHT)) {
if (_root.speed<_root.maxspeed) {
_root.speed += _root.accel;
}
}
if (Key.isDown(Key.LEFT)) {
_root.speed -= _root.accel;
}
}
does anyone know why its not working????
How To Get Speed To A Swf
We need to get speed on big presentation even mac intel lag on those... What's the best way to get speed...
Any Way To Speed This Up?
Hello people!
I was wondering if there is anyway to speed the rendering of this little app that I made.
It basically consist on attaching sprites on golden section based paths.
I'm quite new to AS3 and really looking forward to see its potentials.
I tried to boost the framerate to 300 seeing results in the beginning when I just had a couple of variables but now it seems it has slowed down.
anyway here's the code of the fla:
Code:
StageScaleMode.NO_SCALE;
import fl.events.SliderEvent;
stage.frameRate = 300;
/*
* Constants
*/
var leafNumber:Number = 3000;
var g:Number = 1.618033989;
var rad:Number = 20;
//mask the viewer
var myMask:DrawMask = new DrawMask(-150,-150,300,300,viewer);
/*
* Variables
*/
//User Defined
var rGrowth:Number = 1.002;
var degeneration:Number = .001;
var growthX:Number = .5;
var growthY:Number = .5;
//Already defined :)
var mrGrowth:Number = 1.009;
var mgrowthX:Number = 1;
var mgrowthY:Number = 1;
var mdegeneration:Number = .009;
var ga:Number = 360 - (360/g);
var leafx:Number = 0;
var leafy:Number = 0;
var rot:Number = 0;
var leafAlpha:Number = 0;
var curIter:Number = leafNumber;
//
var sliders:Array = [SrGrowth, Sdegeneration, SgrowthX, SgrowthY];
var maxValues:Array = [mrGrowth, mdegeneration, mgrowthX, mgrowthY];
var values:Array = [rGrowth, degeneration, growthX, growthY];
//Setting sliders value according to predefined values stored in the array
for (var i=0; i<values.length; i++) {
var s:Slider = new Slider();
sliders[i].minimum = values[i];
sliders[i].value = values[i];
sliders[i].maximum = maxValues[i];
sliders[i].tickInterval = (sliders[i].maximum-sliders[i].value)/10;
sliders[i].snapInterval = sliders[i].tickInterval;
sliders[i].addEventListener(SliderEvent.THUMB_RELEASE, sliderChange);
}
//Listeners
generate.addEventListener(MouseEvent.CLICK, startIt);
stopBtn.addEventListener(MouseEvent.CLICK, stopIt);
clearBtn.addEventListener(MouseEvent.CLICK, resetIt);
/*
* Handlers for events
*/
function sliderChange(event:SliderEvent) {
var i:Number=0;
for each (var s:Slider in sliders) {
values[i] = s.value;
i++;
}
}
function startIt(event:Event) {
trace("startDrawing");
addEventListener(Event.ENTER_FRAME, drawLeaves);
}
function resetIt(event:Event) {
rGrowth = 1.009;
growthX = .5;
growthY = .5;
degeneration = .009;
ga= 360 - (360/g);
rad=20;
rot=0;
leafx=0;
leafy=0;
leafAlpha = curIter/leafNumber;
removeEventListener(Event.ENTER_FRAME, drawLeaves);
var children:int = viewer.numChildren;
while (children-- > 1) {
viewer.removeChildAt(children);
}
}
function stopIt(event:Event) {
removeEventListener(Event.ENTER_FRAME, drawLeaves);
}
/*
* rolling drums for ....Main Function !
*/
function drawLeaves(event:Event) {
// if you have still iteration to do
if (curIter) {
curIter--;
// augment the rotation by a goldan angle minus the degeneration variable
ga-=values[1];
rot +=ga;
//augment the radius by rGrowth
rad = rad *values[0];
//make sure it is rotating by a valid angle
rot -= int(rot/360)*360;
//adjust the alpha
leafAlpha = curIter/leafNumber;
//set coordinates for the "leaf"
leafx = Math.cos((Math.PI/180)*rot)*rad;
leafy = Math.sin((Math.PI/180)*rot)*rad;
// draw the leaf
var leaf:DrawLeaf = new DrawLeaf(leafx, leafy, 10*values[2], 10*values[3], rot, leafAlpha);
//add it to the viewer
viewer.addChild(leaf);
} else {
event.target.removeListener;
}
}
and here the one for the main class:
Code:
package {
import flash.display.Sprite;
import flash.display.Shape;
// draw the leaf [TODO] extends the types of leaves
public class DrawLeaf extends Sprite {
/*
* Constructor
*/
public function DrawLeaf(x:Number, y:Number, width:Number, height:Number, rotation:Number, alpha:Number) {
var myShape:Shape = new Shape();
myShape.graphics.beginFill(0x000000, alpha);
myShape.graphics.drawEllipse(x, y, width, height);
myShape.rotation = rotation;
addChild(myShape);
this.alpha = alpha;
}
}
}
thaaanks!
|