Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Help With Path Optimization (source Included)



Hey guys,

I'm hoping that one of you could help me... this is somewhat complicated, so whoever's up to the challenge (source code is in Flash 8):

I'm currently making a simulation in which a bug maneuvers around obstacles to an endpoint. Some obstables (water, etc) reduce the bug's speed, while others (roads) increase it. The endpoint is chosen by a mouse click on the map. To find the best point to move next, a dummy object called "seeker" hovers in a circle around the bug and gathers info about the surroundings (terrain type, direction, etc). Each point around the bug is given a rating, or "pheromone", and the coordinate around the bug that has the best rating will become the bug's new location. A lot of arrays are used to store X values, Y values, and some other stuff. However, for some reason, the code doesn't seem to work. It pops up the "would you like to terminate the program?" debugger message after taking a while to run.

Take a look at the code; I tried to comment it a lot. If you have any questions, let me know and I'll try to check back frequently...

This is a school project due next week, and I'm already sweating about it. PLEASE somebody help, thanks!

~Matt



KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 11-26-2005, 12:27 AM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

[F8] Array Help Source Included
Description:

It is just the archivePage1.fla and the xml file. I need the XML to stay the same. In the .fla file the code is in the middle text field on the left side. It has an array in it that is not populating correctly. The array needs to display the Date from the XML and should be clickable (each date will eventually link to another page and display the full contents (date, subject, etc.) in another page. I need the array to display 5 records on the left page text field and five records on the right page (in the right page text field) and the bottom arrows should refresh the two text fields with the next ten records.

Thanks for any help!

MP3 Player - Source Included
Hi,

I've open sourced my MP3 player here

http://flash.aliseya.com/2007/10/flash-mp3-player.html

I've got a photo album up too. I'm going to add some new components to my site in the future, so if you have any suggestions for things you want added, let me know. I've got a contact form on my site.

XML Menu Source Files Included
Hi flashers
Can anyone please help with this; its so close to being
completed. Click the link below to download the source files and explanations

http://www.rootlevel.co.uk/menu.zip

I think this is where my problem lies; [this sets the visibilty of the menu to true if mouse is over it and false if its not, well that's what im trying to do, it's just the _y values that are causing the trouble]


onClipEvent (mouseMove) {
xMouse = Math.floor(_root._xmouse);
yMouse = Math.floor(_root._ymouse);
distance = _root["button"+_root.nButtons]._y-_y;
if (xMouse<_x || xMouse>(_x+_width) || yMouse<_y || yMouse>(_y+(distance+_root["button"+_root.nButtons]._height))) {
for (j=1; j<=_root.nButtons; j++) {
_root["button"+j]._visible = false;
}
}
}
onClipEvent (mouseUp) {
if (!this.hitTest(xMouse, yMouse, true)) {
for (j=1; j<=_root.nButtons; j++) {
_root["button"+j]._visible = false;
}
}
}

cheers
maccer
[Edited by maccer on 08-27-2002 at 01:15 PM]

Help With Creating Multiple MC,(source Included)
okay here is what I have on the stage in layer called enemy :


Code:
//basic def
this.depth2 = 1;
//i = random(6)+1;

for(a=0;a<6;a++) {

enemyName="oneEnemy"+String(this.depth2++);
this.attachMovie("applets", enemyName, this.depth2);

}


and here is the code for the mc "applets"


Code:
//basic definitions

enemyx = random(400)+50;//_root['oneCloud'+_root.i]._x;
enemyy = -10;//(_root['oneCloud'+_root.i]._y)+5;

this.state = 0; //frame number

this.chooser = random(2)+1; //chooses left or right
//spc = 0;

if(this.chooser == 1) {
this.state = 1;
}
else if(this.chooser == 2) {
this.state = 3;
}

gotoAndStop(1);

enemyvx = -2;//(_root['oneCloud'+_root.i].cloudv); //velocity along x
enemyvy = 0; //velocity along y

yFriction = 1.6; //acceptable values: 2.2 --> 1.6
xFriction = 1.05;
acceleration = 9.8; //gravity

time = Math.floor(getTimer()/1000); //time in whole seconds

this.onEnterFrame = function() {

enemyx += enemyvx; //add velocity to x
enemyy += enemyvy; //add velocity to y

this._x = enemyx; //set x coordinate
this._y = enemyy; //set y coordinate

enemyvx = (enemyvx/xFriction); //lower xvel with horizontal friction
enemyvy = (enemyvy + acceleration + time)/(yFriction); //calculate new velocity

time = Math.floor(getTimer()/1000); //update Time

/*if(spc == 1 || spc == 2 || spc == 3) {
this.state += 1;
gotoAndStop(this.state);
}
else if(spc == 4 || spc == 5 || spc ==6) {
this.state -= 1;
gotoAndStop(this.state);
spc=1;
}
spc++;*/
}



when i test movie nothing shows up, why is this?

Preload Conditional With Source Included
I am having some difficulty with my preloader. I am using code from a tutorial, but it is hacked up in order to get my own load bar working.
As you can see, I had to play with the numbers to get it to work, and I really don't understand why; I only know I had to do it.

Currently, you can see that when the progress bar is complete it goes right to the movie, even if the intro text was not completed.

All I want is for it to have some kind of if(blah and blah){}; that will allow me to fully watch the intro text, even if the progress bar is fully loaded.

There are a few things to note before proceding:

1) The progress bar does not fully go to 100% (from original tutorial)
2) For some reason he removes and then adds the eventlistener back to back...works without removing and adding, but for some reason it is in there.
3) I have the variable for the imported movie set to testsite.swf, so you will need to make one yourself. movie size is 900 x 600
4) I have removed my graphics so that they will not be floating the web. Instead, I left two white hint markers to show my boundaries.
5) I have created another even listener that is envoked by the other listener so that it goes to frame 3. The tutorial I followed left it playing and it uses resources.


So even if this is done, and the intro text plays while the progress bar is completed, the transition to the site will be hard. I think it would be nicer to have a smooth fade to the site, OR already have faded the progress bar out so that it is not sitting there on a static number. Then I would only have to worry about fading out the intro text and bringing the movie into view.

I know I am asking alot, but perhaps even with a little revealed, my options will be opened to complete the rest.

Thank you all for your help.

Target Locking [source Included]
i wrote thise code:

Code:
var i:Number = 0;
var y1 = 0;
var y2 = 0;
var x1 = 0;
var x2 = 0;
var range = 200;
var bad = null;
_root.onEnterFrame = function() {
++i;
_root["k"+i].onEnterFrame = function() {
this.onPress = function() {
startDrag (this, true);
}
this.onRelease = function() {
stopDrag ();
}
y1 = this._y;
x1 = this._x;
y2 = _root.turret._y;
x2 = _root.turret._x;
x_cord = x2-x1;
y_cord = y2-y1;
this.currentDistance = Math.round(Math.sqrt(x_cord*x_cord+y_cord*y_cord));
if(this.currentDistance<range) {
bad = this;
ax = _root.turret._x-bad._x;
ay = _root.turret._y-bad._y;
angle = 180*Math.atan2(ay, ax)/Math.PI;
_root.turret._rotation = 90+angle;
}
}
}
now it works good, when i drag one bad guy into the range the turret faces it and when i drag the other it faces it. but how can i make the turret face the bad guy that is closest to him. like they can both be within sight range but it will only face the one that is closest. im stumped:/

sorry for the double post, i meant to put it here not on games

Action Trouble (source Included)
http://lightning-1.com/alien/help.fla

I'm making a game and in it, I wanted to dynamically call the alien's action to "Dodge" to have it roll onto the stage. The actuall event works fine in the AS case in the seprate AS file, but jus telling to go to a sertain frame and giving it the proper variables wont work for me.

I dont think the AS file is needed for the solution, but if u try and can't figure it out, I can easily give u it.

*edit: Lol, sorry, wrong fla

Preload Conditional With Source Included
I am having some difficulty with my preloader. I am using code from a tutorial, but it is hacked up in order to get my own load bar working.
As you can see, I had to play with the numbers to get it to work, and I really don't understand why; I only know I had to do it.
Currently, you can see that when the progress bar is complete it goes right to the movie, even if the intro text was not completed.
All I want is for it to have some kind of if(blah and blah){}; that will allow me to fully watch the intro text, even if the progress bar is fully loaded.
There are a few things to note before proceding:
1) The progress bar does not fully go to 100% (from original tutorial)
2) For some reason he removes and then adds the eventlistener back to back...works without removing and adding, but for some reason it is in there.
3) I have the variable for the imported movie set to testsite.swf, so you will need to make one yourself. movie size is 900 x 600
4) I have removed my graphics so that they will not be floating the web. Instead, I left two white hint markers to show my boundaries.
5) I have created another even listener that is envoked by the other listener so that it goes to frame 3. The tutorial I followed left it playing and it uses resources.

So even if this is done, and the intro text plays while the progress bar is completed, the transition to the site will be hard. I think it would be nicer to have a smooth fade to the site, OR already have faded the progress bar out so that it is not sitting there on a static number. Then I would only have to worry about fading out the intro text and bringing the movie into view.
I know I am asking alot, but perhaps even with a little revealed, my options will be opened to complete the rest.
Thank you all for your help.

Preload External SWF Help [Source Included]
Hi all,

I have been struggling with this forever so I really hope someone can help me out.
I would like to make a site just like this one:

http://www.kirupa.com/developer/mx2004/transitions.htm

However I would like to preload all the external SWFs in the beggining so that when the user arrives to the mainmovieMX.swf then he doesnt have to wait for the individial pages to load seperately.
So I did a little modifications on the tutorial file above. I have added some images inside the different sections so that they should be bigger, plus in the beggining of each section i have added a preloader so that i can see if then still need preloading or they are already preloaded.

I have tried billion codes and searched everywhere but I cant get them to work. Perhaps there were some that would have worked but they didnt since I didnt know what i was doing doe to my lack of actionscript knowledge.

Unfortunately my source file was 1.3 MB and i cannot attach it here so I have uploaded it here:

http://download.yousendit.com/772F91987CE50458

Thanks in advance for anyone willing to help out.

Urgent, Desperate PHP Thing... Source Included...
hi all,

i'm givin all the source and my question is simple... what i want is, there lies two dynamic text boxes which should display the info that has been submitted by the users from the below fields....

but i don't know the php side and nothing updates after i push the "modify" button....

by the way those files are taken from hi-score tut... but my aim is completely different...

IT IS SIMPLE i just want to be able to update the contact infos and by the help of those files without FTPing, without uploading .txt files(that's a classic one that everybody does) or using them as a source...

just by the help of that php file being able to update the info in seconds....

thnx all.... and i'm desperate and worse, it's urgent... i don't think that writing a correct or simple10-15 lined php should be so hard for pro-people...

thnx.... and thnx....

Help With Scroller Issue - Pics And Source Included
Hey,

I'm trying to make a fullscreen flash scroll bar and have been making some progress, in terms of adjusting a scrollbar to a fullscreen. Anyway, I've hit a bit of a stumble. In my function Stage.onResize I'm trying to make the scrollbar dragger a percentage of the amount of content which is shown on the screen as the picture below shows.

The problem is that when you scroll down for some reason the _y position of the scroller is creating a gap, which seems to become bigger the more you drag the scroller down (make sure you have the content displayed in a box like the picture, otherwise the scroller won't show because all the content is on screen.. like a scroller should do!).

So the red line is aligning to the scroll dragger's y position to show my point.

What I want to be able to do is when you drag the scroll dragger I want it to stop when you get to the bottom, at the moment it seems to be going to the bottom and beyond. I want it to stop when you get to the bottom of the content (all content shown on screen) like a normal html scroller.

It might be important to note that I have changed the registration points a little, as you'll see in the fla.

Any help on this would be greatly appreciated.

Here are a couple of pictures to illustrate the problems and source files and code.










Code:
//import for mac scrollwheel operation
import com.pixelbreaker.ui.MouseWheel;

stop();
//Align at top left?
Stage.align = "TL";
Stage.scaleMode = "noScale";
// Padding between top of stage and content **MAKE THIS A PERCENTAGE**
var contentPadding = 30;
//Set the position of the content in the middle of the screen upon movie load
content_mc._x = Stage.width/2;
content_mc._y = contentPadding;
//Position the scroller to the right and to the height of the stage upon movie load
scroller_mc._x = Stage.width-scroller_mc._width/2;
scroller_mc._y = 0;
scroller_mc._height = Stage.height;
// y position on top of the content box
var topContentBox = content_mc._y;
//Create new listener object to listen to stage resize
var stageResizeListener:Object = new Object();
//Everytime the stage is resized...
stageResizeListener.onResize = function() {

// Amount of content in pixels displayed on screen
var contentOnScreen = Stage.height-topContentBox;
// Percentage of content shown on screen
var pctContentOnScreen = contentOnScreen/content_mc._height;
//Position the scroller to the right and to the height of the stage
scroller_mc._x = Stage.width-scroller_mc._width/2;
//scroller_mc._y = Stage.height/2
//Set the position of the content in the middle of the screen
content_mc._x = Stage.width/2;
//scroller_mc.scrollerBar_mc._height = Stage.height;
scroller_mc.scrollerBar_mc._height = Stage.height;
//trace(Stage.height);
scroller_mc.scrollerDragger_mc._y = 0;
if (pctContentOnScreen<1) {
scroller_mc.scrollerDragger_mc.enabled = true;
scroller_mc.scrollerDragger_mc._visible = true;
scroller_mc.scrollerDragger_mc._height = pctContentOnScreen*(Stage.height-100)/2;
scroller_mc.scrollerDragger_mc._y = 0;
} else {
scroller_mc.scrollerDragger_mc.enabled = false;
scroller_mc.scrollerDragger_mc._visible = false;
}
//pctDraggerOnScreen = scroller_mc.scrollerDragger_mc._height / Stage.height;
//trace(pctDraggerOnScreen);
//this.scroller_mc.scrollerDragger_mc._y = topContentBox;
};

//create a listener for when the stage is altered
Stage.addListener(stageResizeListener);
scroller_mc.scrollerDragger_mc.onPress = function() {
//**WORKING ON THIS!!**//
this.startDrag(false,this._x,0,this._x,scroller_mc.scrollerDragger_mc._height+Stage.height);
};


scroller_mc.scrollerDragger_mc.onRelease = scroller_mc.scrollerDragger_mc.onReleaseOutside=function () {
this.stopDrag();
};

onEnterFrame = function () {
holder_mc._y = scroller_mc.scrollerDragger_mc._y;
};

Rewinding Navigation _bar (is A Nested Button A No-no? Source Included)
I have here a navigation bar, I have a seperate action controller clip so it
can rewind on mouseout. Works fine and dandy until you rollover the nested button then it kinda chokes on itself while it see's you are on the button.
In theory this kind of thing should work (famous last words). only first button
has been done so far.

FLASH WEBSITE WONT WORK - Source Files Included
Hi guys...a friend of mine sent me this flash file ( check attached doc ) and I can't seems to make it work. the problem is when I save it in flash 8 and play it, it goes completely blank. Can anybody help? Thanks in advance.

Add Play/Pause To Great Photo Gallery With Fade And Resize - Source Included
Here's some great code I pieced together using this forum. I would like to add Play/Pause functionality to it. Please have a look at the .fla :

photo_gal_fade_resize.zip

Any suggestions/comments will be much appreciated!

Code:
delay = 6000;
p = 0;
// ///////////////////////////////////
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
/*
description = [];
*/
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
/*
description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
*/
}
// /*
firstImage();
} else {
content = "file not loaded!";
// */
}

}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");

// ///////////////////////////////////
listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
prevImage();
} else if (Key.getCode() == Key.RIGHT) {
nextImage();
}
};
Key.addListener(listen);
this.previous_btn.onRelease = function() {
prevImage();
};
this.next_btn.onRelease = function() {
nextImage();
};

// ///////////////////////////////////
spacing = 10;
containerMC._alpha = 0;
MovieClip.prototype.loadPic = function(pic) {
this._alpha = 0;
this.loadMovie(pic);
this._parent.onEnterFrame = function() {
var t = containerMC.getBytesTotal(), l = containerMC.getBytesLoaded();
bar._visible = 1;
per = Math.round((l/t)*100);
if (t != 0 && Math.round(l/t) == 1 && containerMC._width != 0) {
var w = containerMC._width+spacing, h = containerMC._height+spacing;
border.resizeMe(w,h);
bar._visible = 0;
frame._visible = 0;
loadText.text = "";
delete this.onEnterFrame;
} else {
bar._width = per;
//gives the bar a max width 100
loadText.text = per+" % loaded";
}
};
};
MovieClip.prototype.resizeMe = function(w, h) {
var speed = 3;
this.onEnterFrame = function() {
this._width += (w-this._width)/speed;
this._height += (h-this._height)/speed;
if (Math.abs(this._width-w)<1) {
this._width = w;
this._height = h;
containerMC._x = this._x-this._width/2+spacing/2;
containerMC._y = this._y-this._height/2+spacing/2;
containerMC._alpha += 5;
if (containerMC._alpha>90) {
containerMC._alpha = 100;
delete this.onEnterFrame;
}
}
};
};

// ///////////////////////////////////

filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
/*
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
bar._visible = 1;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
bar._visible = 0;
if (picture._alpha<100) {
picture._alpha += 10;
}
}
};
*/
var myInterval;
function nextImage() {
p++;
p %= image.length;
//if (loaded == filesize) {
containerMC.loadPic(image[p], 1);
/*
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
*/
picture_num();
//trace(p);
this.selected_mc.gotoAndStop(p+2);
clearInterval(myInterval);
if (btn.playing) {
slideshow();
}
//}
}
function prevImage() {
clearInterval(myInterval);
if (btn.playing) {
slideshow();
}
if (p>0) {
p--;
} else {
p = image.length-1;
}
containerMC.loadPic(image[p], 1);
/*
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
*/
picture_num();
//trace(p);
this.selected_mc.gotoAndStop(p+2);
}
function firstImage() {
if (loaded == filesize) {
containerMC.loadPic(image[0], 1);
/*
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[0], 1);
desc_txt.text = description[0];
*/
picture_num();
clearInterval(myInterval);
if (btn.playing) {
slideshow();
}
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+"/"+total;
}
function slideshow() {
myInterval = setInterval(pause_slideshow, delay);
function pause_slideshow() {
clearInterval(myInterval);
nextImage();
}
}
btn.t.text = "STOP";
btn.playing = true;
btn.onPress = function() {
if (this.playing) {
this.playing = false;
clearInterval(myInterval);
this.t.text = "PLAY";
} else {
this.playing = true;
nextImage();

this.t.text = "STOP";
}
};

// ///////////////////////////////////
//containerMC.loadPic("images/wed/wed1/1.jpg");

Logging VOD Or Live: File Path Not Included?
I'm looking for a way to log VOD and live streams, preferably with a CLF style syntax.

Specifically I'd like to log the content path (directories under the root and the filename), the remote IP, timestamp and server-to-client bytes.

I'm unable to extract this info from the default logging setup. This is critical to the acceptance of FMS in our organisation, as we need extensive accounting information.

FLVPlayback Source Returning Local Path
I'm having an issue with the FLVPlayback component using a Local Source when it's being viewed from online.

Setup:
config.xml contains a path to the videos.xml file
videos.xml contains the path to the FLV
loadFlv() sets the source to the FLVPlayback to the file given by videos.xml

Testing:
i'm creating a TextField dynamically that will return the FLVPlayback.source when loadFlv() is ran

Local Publishing:
When I Publish locally i get correct FLV and the source is located on the web. Just what should be happening.

Web Publishing:
When I upload my published files to the web and view, the source that is being returned is a local file, and not even to the correct folder.

I've triple checked all my files and there is no place for the Local directory to be coming from... any thoughts?

Library Source File Path Is Wrong
I have created a fla to hold all the graphic elements of a project. When I add one of these elements to a different fla I set it to update on publish so if I make a change to the original it applies automatically. The problem is when I tell it to update, it can't find the original. If I look at what flash set the relative path to the source document as it say "./uiAssets.fla" when it should be "../uiAssets.fla" because they aren't in the same folder.

Is this a bug or am I doing something wrong?

Tween Class/360vr Tour/path Problem - W/source.
I'll start off by saying I'm using Flash 8, Actionscript 2.0, and exporting as FlashPlayer 6.

I'm trying to do this long landscape with a movie clip labeled, "mainMovie", let's say it's approximately 3600 x 600, while the stage/document dimensions are 800 x 600 .

I have script on it so that moving the cursor to the left or right edge of the stage, the entire movie clip shifts left or right and through the rest of the landscape, similar to the 360 vr tours you see for some real estate sites online.

On the main stage, I have that movie clip called, "mainMovie". Inside "mainMovie", is another clip called, "singleStrip", and inside that clip, I have other smaller movie clips through the landscape which are labeled and consist of random stuff, like shapes and items and stuff.

Everything works fine. The extra step that I am attempting is that I want the user to be able to scroll through the clip, "click" on an item, and then that item zooms into the front center stage and plays a small animation about that item. These items that are found throughout the landscape are movie clips themselves with script on them to be recognized as buttons.

My problem with that is even though the center of my stage would be x=400, y=300, since my mainMovie on the stage scrolls from left to right, when I put in code to tween the item to a center position, that position is only set to the inside of the movie clip and not the center of the stage. I need to center a movie clip within two other clips to the stage.

An example of the path of any of those items would be sort of like,
_root.mainMovie.singleStrip.book


... and the tween script I have inside the "singleStrip" movie clip, where all these items are reads as:

function tweenbook() {
easeType = mx.transitions.easing.Regular.easeOut;
var beginx = 74;
var beginy = 93;
var endx = 400;
var endy = 300;
var time = .75;
var mc = book;
var begin_xscale = 40;
var begin_yscale = 40;
var end_xscale = 100;
var end_yscale = 100;
bookTween = new mx.transitions.Tween(mc, "_x", easeType, beginx, endx, time, true);
bookTween = new mx.transitions.Tween(mc, "_y", easeType, beginy, endy, time, true);
bookTween = new mx.transitions.Tween(mc, "_xscale", easeType, begin_xscale, end_xscale, time, true);
bookTween = new mx.transitions.Tween(mc, "_yscale", easeType, begin_yscale, end_yscale, time, true);

}


This obviously moves the book to the center an x and y position for "singleStrip", and not the stage. The line of code I want to alter is the "var endx" and "var endy", and this is where I get confused with what I need to do, or whether it's possible. I at one time, tried something like,


var endx = stage.width._x / 2;
var endy = stage.height._y / 2;

That didn't work. It shifted it to a different position, not being the center of the stage.

At another point, I tried to fake it out, placing a movie clip of a red ball on the main timeline in the center of the stage, and changed my code to:

var endx = _root.centerBall._x;
var endy = _root.centerBall._y;

(This didn't work, either).


If you look at the .swf, you'll see that if you move your mouse pointer to the left or right of the movie, your landscape shifts in that direction. For now, I threw in letters as placeholders to give you the idea of what I'm trying to do.

My intention is when you click on the item, in this case the letter, it will zoom up to the center of the stage and a movie clip animation will then play about that object.

I do have a red ball sitting in the middle of the .fla stage as a guide layer just to show around the area I want the item to appear.

Also, because I want that internal animation to play, I figured I'd throw on a second frame on the main timeline for the scrolling landscape to just "hold" while the object animation plays. When it's finished, I plan to get it back to where it was on frame 1.

The only thing I was having trouble with as I mentioned previously, centering the individual item movie, (in this case, the letter), to the center of the stage. I was having a hard time with it because it's inside a movie clip that is already shifting around the stage left to right.

Can anyone help me or have any suggestions to try... ? I do have other code that affects the motion scroll of the mainMovie from left to right, but I don't think this is the problem, I could be wrong.

Any help is GREATLY appreciated.

Thanks in advance.

Using Included Prototypes From Outside Where They Were Included.
How can I do this? I have the tweeing prototypes pack included in my main actionscript block, but I want to use it from some other movieclips. Is this possible?

Dynamic Tree: SOURCE. A Million People Have Done This, But No One Has Posted Source
Here is the source of a dynamic fractal tree, it also has a function making it have a wind effect. You can see it without the sway on the front page of my site. My site sucks by the way, so don't bother telling me how horrible it is.

Link: www.michael.harvardroad.com

-Michael

Dynamic Tree: SOURCE. A Million People Have Done This, But No One Has Posted Source
Here is the source of a dynamic fractal tree, it also has a function making it have a wind effect. You can see it without the sway on the front page of my site. My site sucks by the way, so don't bother telling me how horrible it is.

Link: www.michael.harvardroad.com

-Michael

Training From Source: Source Files..
Thought I'd try here.. I have the FlashMX2004 actionscript training from the source book and my cd cracked.

I have't been able to find a location yet where I can download all the code.

It's more a lazy thing I guess, but I also like to have the 'correct' stuff before I mess with it.

Does anybody know where I can download the code from? Or, is there anyway a nice fat zip could be sent to me? (kelly@thumbslinger.com)

I can prove ownership by any means necessary (other than a receipt as the book is old but still viable)

Thanks

Using Eval Function And Variable In A Path (target Path)
Hello,

I have to reprogram some of my website and it calls to conjugate strings in a way that's beyond my understanding. Please help me with some suggestions. Kind regards.

the original code is:

code:
if (_global.useCount<10) {
//hide
var diff = 10-_global.useCount;
for (diff; diff>0; diff--) {
eval(String(11-diff))._visible = false;
}
}

There are buttons named 1 to 10 and this turns off the ones that are not used. Now I want to nest those buttons in subclip "buttonsRow", instead of having them on main timeline. How do I rewrite that code to make it work with new path?

I have already tried the "associative array" method, but it don't really know how to pack the whole eval function in there. I've tried many combinations, like:

code:
this.buttonRow[eval(String(11-diff))]_visible = false;
//or
this.buttonRow["eval(String(11-diff))"]_visible = false;
//or
buttonRow[eval(String(11-diff))]._visible = false;
//or
buttonRow["eval(String(11-diff))"]._visible = false;
//or
buttonRow[eval(11-diff)]._visible = false;
// or
buttonRow[8]._visible = false;
//the last one at least turns off button 8, lol

Some of those return syntax error and some just don't work. Anyone have any ideas? Thank you again.

Cannot Export An Avi Of Motion Along A Path When Path Is Specified With Action Script
Hello!
I have the following problem: I am using Flash 8 Professional to produce a series of avi files showing the motion of a dot along different paths. Whenever I use the drawing tools to draw the path everything is all right: I can export both a swf and an avi file showing the motion. The problems start when I use action acript to specify the path: then a swf can be exported, but not an avi file (Flash acts as if it is exporting but the avi file produced shows only a stationary dot). Can anybody help me?

Optimization Help
I am designing my first flash site and I was in need of some tips for optimization (i.e. what to load first and how to do it) Under the bandwith profiler it says my preload is 89.8 seconds. Thanks.

Optimization
Greetings,

I am building a high school reunion site that requires a lot of pictures. I am having trouble with download times in my flash movies. I have optimized the jpegs as much as they can be without degrading the quality to the point of being ugly. I have divided the movie into about 35 scenes and I have have many more to go. I know there is another way to accomplish my goal, but I am stuck. Are there anysuggestions on loading the jpegs without comprimising quality and/or performance?

Optimization
What's the best way to go about optimizing my flash movie/website for the web? It has a lot of pictures and some of the pictures were much larger in size than they needed to be so I just scaled them down in flash itself. Should I use photoshop or something to make the pictures smaller in size or something? Or when I publish it, will flash automatically optimize the stuff? Right now when I debug and view streaming, the preloader takes forever because there's 2.4mb to load and I need to make it as small as possible without taking anything off of the site...

Optimization
My Flash file is only 136K, yet it takes forever to load on the website. I know I need to optimize it. (Obviously I'm a newbie)

Is there a step-by-step rule I can follow to optimize this flash file?

Thanks...

Need Some Help With Optimization
I have a site that I've been working on, someone else designed it and I've built the flash. It's kind of an unorthodox site and seems to be pushing some limitations in Flash - when it runs on my machine at home, it runs OK, but over the web, there is one part of the movie that i have not been able to get to run smooth.

I'd appreciate it a lot if some of the experienced flash developers could take a look and give some advice.

the site is at histrionics.org/index2.php

some notes about the main flash movie that make me wonder if i'm trying to do too much at one time:

1. it's 2880 pixels wide. I think this is the maximum that flash allows

2. there are two mp3s playing (the seagulls, and another that turns on/off when you mouseover the control) and 10 animated, clickable birds, plus a drawing tool, a scrolling marquee, and a filmstrip. all of these elements draw information from text files on the server to know what to play -- the mp3, the pictures to display, the text in the scroller, and the links on the birds.

3. the problem is with the filmstrip, which is the first thing on the left. it runs totally choppy. i've tried simplyfying it and haven't been able to get it to work smooth with all the other stuff going on. plus the marquee is jittery, but i think this is because of the images loading up in the filmstrip. when i take the filmstrip out, the rest of the movie runs smooth.

I've never built a flash movie like this before, so I'm not sure where to draw the line with what is too much for a movie. and, i've been to other flash sites that have had so much going on that they crash my browser, etc. i dont want this site to do that!!

can someone please take a look and let me know if you have any thoughts on how i might optimize it. i'm not looking for input on the design, etc but on the performance.

thanks!

Frizzo

Optimization
Yeah, so basically i am a newbie with flash, learning trial by error with reference to manuals (probably making it harder than it should be). Anyway, I created a little test movie and have it posted on my site. It runs kind of slow sometimes and is 1.38 MB's. How could i optimize it to run more consistently. Sometimes it runs smooth on loading and sometimes it runs slow or even freezes. The *.FLA is 50 frames consisting of about 40 photos (about 60KB a photo). Check it out and give me some suggestions. When i can get the whole thing flowing smoothly and bring the file size down i want to make this an interactive type of browsing feature.

All criticism is welcome here. Thanx, jeff

www.jeffhalbe.com/loop.htm

Optimization Help
Hello,

I'm working on a electric beam/lightning animation. It is working quite allright, but I was wondering if anybody would have some ideas for optimization of the drawing.
Here is the code that draws the beam. the movingPoints array is calculated in another method. p1 is the starting point and p2 is the end point.

code:
/**
* Draws this ElectricBeam. It calculates a random position for the points
* between the outer points based on their position.
*/
public function draw():Void {
// Clear the beam.
clip.clear();
// Calculate the random position of each moving point.
var points:Array = new Array();
var nOP:Number = movingPoints.length;
for (var i:Number = 0; i < nOP; i++) {
// Calculate the maximum amplitude for the point according to its position in the beam.
var a:Number = ampl * Math.sin(((i+1)/(nOP+1))*Math.PI);
// Calculate the direction of movement.
//var dir:Number = random(3) - 1;// (up, none or down)
var dir:Number = random(2)*2 - 1;// (up or down)
// Now calculate the how much the point will move (like if the beam was horizontal).
a = dir * Math.random()*a;
// Calculate the position of the point.
var x:Number = Math.round(movingPoints[i].x + (a * Math.sin(-angle)));
var y:Number = Math.round(movingPoints[i].y + (a * Math.cos(angle)));
var p:Point = new Point(x, y);
points.push(p);
}
// Draw the less visible layer.
clip.moveTo(p1.x, p1.y);
clip.lineStyle(10, color, 25);
for (var i:Number = 0; i < nOP; i++) {
clip.lineTo(points[i].x, points[i].y);
}
clip.lineTo(p2.x, p2.y);
// Draw the medium visible layer.
clip.moveTo(p1.x, p1.y);
clip.lineStyle(6, color, 50);
for (var i:Number = 0; i < nOP; i++) {
clip.lineTo(points[i].x, points[i].y);
}
clip.lineTo(p2.x, p2.y);
// Draw the full visible layer.
clip.moveTo(p1.x, p1.y);
clip.lineStyle(2, color, 100);
for (var i:Number = 0; i < nOP; i++) {
clip.lineTo(points[i].x, points[i].y);
}
clip.lineTo(p2.x, p2.y);
}

The main point is that in one method there are 4 for-loops, which becomes quite expensive when there are a lot of points in the beam. I use three different layers of alpha, since it gives a more realistic feel to it.
Is there an effective way of optimizing this bit of code?

Regards,
Jorrit

Optimization In AS2.0
Hi does anyone know about optimization method in the way you code in AS2.0 ?
if you have tips or tricks that'll make ur script run faster or resources on this, would you like to share it with me or us (hey it's a forum)

thanks guys

More Optimization Help...
Can someone please help me understand the following? I have a graphic (png) in my movie, I'm doing a basic tween on it that just makes it shrink. The longer, or more frames that this tween lasts, the larger my file size.

Why is this? Flash only needs to load the information from the png once. I can understand if it makes it more processor intensive but why file size?

Any advise on optimizing it for file size?

Optimization Help
hey,

ive been told theres not much i can do...but i ran my cpu meter on my flash site, and it maxes it out every time i run it. can anyone help me get this thing running smooth?

it doesnt use any vectors other than the menu (vectorized png's) and all other content is png with transparency.

thanks.

~keane

fla: http://www.qream.com/flashmainloader.fla

Optimization Help?
Hi everyone,

I'm working on a flash movie, but need serious help / advice on optimizing it properly... The main problem is that I'm using transparent .png files in it, and, although they're only a few k each, there are a lot of them!

Also, I'd really like one of the png files to flicker on and off in the background (see link), this looks great, but kills processors...

http://www.mysteriousal.com/newsite/index.html

I have very VERY little experience with actionscript, but I'm sure it could help me here.... any tips?

cheers for reading...

Optimization
What's up all! I'm an up and coming flash developer and seem to know just enough to get myself in trouble. I have 2 flash sites which take entirely to much time to load. The size of the .swf files aren't too bad, however they are both loading external files ie mp3's (via xml) and images (via java scripting). I need to get these movies loaded a lot faster than they are currently. I've trimmed them as much as i could cutting out frames and duplicate symbols. Any suggestions would be appreciated. The sites are:

www.stldrifters.com and www.elmossdesigns.com

the drifters site is the biggest problem so please take a look and let me know what i can do to optimize these big b@stards! Thanks!

SWF Optimization
I have a flash site that's approximately 7 mb. Does anybody know of any good methods, tools to optimize the swf file so that the site loads faster.

Much appreciated.

Optimization Help?
Hi everyone,

I'm working on a flash movie, but need serious help / advice on optimizing it properly... The main problem is that I'm using transparent .png files in it, and, although they're only a few k each, there are a lot of them!

Also, I'd really like one of the png files to flicker on and off in the background (see link), this looks great, but kills processors...

http://www.mysteriousal.com/newsite/index.html

I have very VERY little experience with actionscript, but I'm sure it could help me here.... any tips?

cheers for reading...

Psp Optimization
recently sony released firmware 2.7 for the psp, this release included a flash player. unfortanately most swf's run like crap. to try to improve this i have been trying to find ways to make the file's run smoother.
I changed to demensions of the stage to those of the psp, decreased the FPS, but it still runs poorly. Any other ideas on optimizing for the psp.
(note that the player supports files up to flas 6)

Optimization
Im just making things to keep learning new things, and i made a object menu that has potential in my mind at least. I'm attaching the file for those who feel like looking. Two things:

one: If you could, can you show how the actionscript can be optimized/shortened. Or just a better way to do what it does.

two: Stumped on how to have it so that the box in the middle move back to its originial location when another box is clicked on. I was going to use some kind of hitTest with an invisible movieclip to get the name of the box that was in the middle but couldnt figure out have the hitTest function by something along the lines of "If anythings hits this movieclip, save that movieclips name to a variable and perform these actions"

Thanks for prior and future help

Optimization Help
I am developing the homepage for a site ( dev.silverseal.net/index_main.htm ) which is made up of a shell site which loads 4 external .swfs an external text file. Whenever I have the page open in the browser my memory usage shoots up to 100% and stays there for as long as the flash page is on screen. There is not that much animation (and I've even removed it to test), and I am in the process of streamlining each of the .swfs (the biggest being 19k), but I don't really think that is the issue.

Does anyone have any ideas that I can try (or questions about info that I haven't provided)?

Thanks,
E.

Optimization Help
Hi everyone,

I'm working on a flash movie, but need serious help / advice on optimizing it properly... The main problem is that I'm using transparent .png files in it, and, although they're only a few k each, there are a lot of them!

Also, I'd really like one of the png files to flicker on and off in the background (see link), this looks great, but kills processors...

http://www.mysteriousal.com/newsite/index.html

I have very VERY little experience with actionscript, but I'm sure it could help me here.... any tips?

cheers for reading...

Flv Optimization
Hi all,

any one help me for

How i optimize the size of my flv file?????


Thanks in advance

FLV Optimization
Hey everyone,
I really just need a piece of advice. I am using a swf as an animated background for my web portfolio. Now, the way I had to set it up is, I converted a .mov file to FLV, imported the FLV into the timeline of a swf, and I'm using another swf as a preloader to load the animation onto the page. The preload is pretty small (file size wise), however the swf containing the FLV animation is about 2.5mb (I know that pretty big for web). At this point I'm guess you are asking yourself, "Why the heck would he do that", well, my host does not have a media server that will support steaming flvs and I dont want the movie to be download because of copyright restrictions.

What is really strange about all this is the progress bar rarely displays load pregress. It does sometimes but not other. So the swf just appears and plays once loaded, and it sometimes takes about 30secs to load.

Now, that I feel I have explained myself, My question is, how can I lower this load time without cutting too much quality of the video?

Things you most likely need to know.
My Preloader is similar to the AS3 preloader tutoral on gotoandlearn.
The FLV was compiled with high quality.
The FLV was imported into a seperatate swf as a movie clip and placed on the stage.

No additional code was created

www.jcnewhouse.com/Portfolio.aspx

Jpeg Optimization
Hi...I was wondering and I have never really figured out a really efficient way to optimize jpegs that I am importing into flash. Can anyone point me in the right direction or reveal any secrets to optimizing jpegs that I want to import to flash? I am looking to reduce as much file size as possible and keep picture clarity, Whether it be thumbnails or larger size pics.

Thanks everyone.

Code Optimization
I'm A little bit new to Actionscript programming and I am having trouble with code optimization. I have this multiple droptargets that have the same name and the practically the same code structure, that will follow below.

There's gotta be a way of simplifying this humongous amount of lines. The comments inside the code ar explaining my difficult.

Thanks a lot folks.

code:
on (press) {
if (_root.target1.ocupado == true) {
startDrag(this.who_occupies);
this.who_occupies.swapDepths(100);
_root.target1.ocupado = false;
}
}
on (release) {
stopDrag();
this.who_occupies._x = _root.target1._x;
this.who_occupies._y = _root.target1._y;
_root.target1.ocupado = true;
}
on (releaseOutside) {
stopDrag();

// Next line makes this button dissapears

_root.target1.gotoAndStop(1);

// The code bellow is the one that needs optimization

if (eval(this.who_occupies._droptarget) == _root.target1 && _root.target1.ocupado == false) {
this.who_occupies._x = _root.target1._x;
this.who_occupies._y = _root.target1._y;
_root.target1.ocupado = true;
_root.target1.who_occupies = this.who_occupies;
_root.target1.who_brought = this.who_brought;

// the line bellowe makes this button appear
// this button is inside all MovieClips target#
// and the code is pretty much the same in everyone.

_root.target1.gotoAndStop(2);

// Notice now that the code bellow is a exact copy of the code above
// The only difference is the Target Number.
// I wonder if there is a way of writing this just once.
// with some sort of a counter loop.

} else if (eval(this.who_occupies._droptarget) == _root.target2 && _root.target2.ocupado == false) {
this.who_occupies._x = _root.target2._x;
this.who_occupies._y = _root.target2._y;
_root.target2.ocupado = true;
_root.target2.who_occupies = this.who_occupies;
_root.target2.who_brought = this.who_brought;
_root.target2.gotoAndStop(2);
} else if (eval(this.who_occupies._droptarget) == _root.target3 && _root.target3.ocupado == false) {
this.who_occupies._x = _root.target3._x;
this.who_occupies._y = _root.target3._y;
_root.target3.ocupado = true;
_root.target3.who_occupies = this.who_occupies;
_root.target3.who_brought = this.who_brought;
_root.target3.gotoAndStop(2);
} else if (eval(this.who_occupies._droptarget) == _root.target4 && _root.target4.ocupado == false) {
this.who_occupies._x = _root.target4._x;
this.who_occupies._y = _root.target4._y;
_root.target4.ocupado = true;
_root.target4.who_occupies = this.who_occupies;
_root.target4.who_brought = this.who_brought;
_root.target4.gotoAndStop(2);
} else if (eval(this.who_occupies._droptarget) == _root.target5 && _root.target5.ocupado == false) {
this.who_occupies._x = _root.target5._x;
this.who_occupies._y = _root.target5._y;
_root.target5.ocupado = true;
_root.target5.who_occupies = this.who_occupies;
_root.target5.who_brought = this.who_brought;
_root.target5.gotoAndStop(2);

// this makes the MovieClip who_occupies go to its original position
// and the MovieClip who_brought go to its first frame
// that holds a button similar to this one
// that first held the MovieClip who_occupies under a differen name,
// like picture#

} else {
this.who_occupies._x = this.who_occupies.originalX;
this.who_occupies._y = this.who_occupies.originalY;
this.who_brought.gotoAndStop(1);
}
}

Graphic Optimization?
My games tend to lag horribly. Maybe if I knew a thing or two about optimizing graphics in Flash, my games would run a lot faster. Can anyone help me out? What should I know about graphic optimization in Flash so my games don't lag?

Vector Art Optimization
I am having trouble making my vector art weigh less in flash. I was using more vector art because I had understood it was obviously lighter than bitmaps. But this simple logo (attached in Freehand, you can import it into flash with no problem) weighs 1106 bytes just in itself. PLEASE someone help me out here!!!


thanks!


Ceci

Optimization Problems
i neeed my movie to be under 5 megabytes and it is 5.5, i have optimized the audi streamed it all, and optimized all the imaes but it is still large, can anyone help?

Copyright © 2005-08 www.BigResource.com, All rights reserved