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




[CS3] Efficient Way Of Replicating MovieClips?



On my main timeline I have two dynamic text boxes and an input box that represent a math problem. I wanted there to be three problems on the screen at a time. Since I don't know much about classes and making packages I just copied and pasted the problem twice so that I have three instances of each text box. Next I basically just tripled my lines of code, one block for each of the three problems.

I'm assuming the proper way to handle something like that is to make the problem a MovieClip and then make a class for it. However, when I attempted to do that I got errors [possible undefined function] because code that still remained on the Main Timeline was referencing functions that had been moved from the Timeline into the mcProblem class. Could I change the code on the Timeline so that I won't be getting these referencing errors? If not, could you please provide some detailed information about what I should do regarding classes? Currently I am not using a document class.

If anyone understands what I'm trying to do, please guide me in the right direction. This is my first attempt at a solo project (for fun) and while I can achieve the desired swf sloppily I prefer to learn to do it the clean and efficient way.



FlashKit > Flash Help > Flash Newbies
Posted on: 06-02-2008, 12:29 PM


View Complete Forum Thread with Replies

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

Replicating An Effect
say there's one particular "effect" i want to use on several different symbols, what's the best way to go about reproducing it? for example, let's say i find a particular way of affecting color and size with lots of tweens that makes a really nice "shine" effect, and want to use the same settings on 30 or 40 different text and/or image links - how should i go about it?

tyia

Help In Replicating Menu
Hi,
I am working on a website and want to integrate a Flash menu, with the same type layout as the one used here (http://www.islandrecords.com/thekillers/site/home.las). I'd like a menu list where you get sub-menu items when you roll over the buttons. I'm just getting into learning Flash, and could use some help. I've got my main image and my buttons created on seperate layers. But I don't know how I should put the sub-menu items in, or how to get them to appear when you roll over the buttons. Any assistance in how to properly set this up is much appreciated. Thanks in advance. - Eric

Replicating An Applet
Hi,
I saw this applet that basically had heaps of points arrange in columns and rows, that when u clicked and held the left mouse button down they would move towards the mouse, and move away if the right button was clicked.

so the question is how do i make this code 4 making the points arrange on stage simpler I am sure there is a better way.


Code:
a = 0;
j = 1;
for (i=1; i<11; i++) {
peete = [i, j];
_root.attachMovie("point", peete, 1+i);
a = a+60;
b = 60;
_root[peete]._x = a;
_root[peete]._y = b;
}
a = 0;
j = 2;
for (i=1; i<11; i++) {
peete = [i, j];
_root.attachMovie("point", peete, 20+i);
a = a+60;
b = 120;
_root[peete]._x = a;
_root[peete]._y = b;
}
a = 0;
j = 3;
for (i=1; i<11; i++) {
peete = [i, j];
_root.attachMovie("point", peete, 40+i);
a = a+60;
b = 180;
_root[peete]._x = a;
_root[peete]._y = b;
}
a = 0;
j = 4;
for (i=1; i<11; i++) {
peete = [i, j];
_root.attachMovie("point", peete, 60+i);
a = a+60;
b = 240;
_root[peete]._x = a;
_root[peete]._y = b;
}
a = 0;
j = 5;
for (i=1; i<11; i++) {
peete = [i, j];
_root.attachMovie("point", peete, 80+i);
a = a+60;
b = 300;
_root[peete]._x = a;
_root[peete]._y = b;
}
a = 0;
j = 6;
for (i=1; i<11; i++) {
peete = [i, j];
_root.attachMovie("point", peete, 100+i);
a = a+60;
b = 360;
_root[peete]._x = a;
_root[peete]._y = b;
}
a = 0;
j = 7;
for (i=1; i<11; i++) {
peete = [i, j];
_root.attachMovie("point", peete, 120+i);
a = a+60;
b = 420;
_root[peete]._x = a;
_root[peete]._y = b;
}
a = 0;
j = 8;
for (i=1; i<11; i++) {
peete = [i, j];
_root.attachMovie("point", peete, 140+i);
a = a+60;
b = 480;
_root[peete]._x = a;
_root[peete]._y = b;
}
a = 0;
j = 9;
for (i=1; i<11; i++) {
peete = [i, j];
_root.attachMovie("point", peete, 160+i);
a = a+60;
b = 540;
_root[peete]._x = a;
_root[peete]._y = b;
}
a = 0;
j = 10;
for (i=1; i<11; i++) {
peete = [i, j];
_root.attachMovie("point", peete, 180+i);
a = a+60;
b = 600;
_root[peete]._x = a;
_root[peete]._y = b;
}
also i am using a mouse down clip event to make the points move to the mouse how do i make this happen for the whole time the mouse is down not just the click?

Help Replicating Effect
Hi all,
just wondering if anyone could give any help... I am trying to copy the effect on this page.


www.bbc.co.uk/radio1

when you hover over a picture, info pops up from the bottom.

Any clues?

Many thanks :-)

Self Replicating Program
Can anyone use AS3 (or AS2 I suppose) to write a script that can reproduce itself? Successful program should export code (into a TF or the output panel) that can be copied into a new flash file and run to repeat the same output indefinitely.

I've seen this posed for other languages but I'm not sure how to tackle it in AS3...yet.

Replicating A Pattern
This time round i need to get the pattern drawn on the drawing board to be repeated on another area of the stage.I need it to be repeated 4x4 tile. Any idea??

Replicating A Pattern
This time round i need to get the pattern drawn on the drawing board to be repeated on another area of the stage.I need it to be repeated 4x4 tile. Any idea??

Replicating MM Search Input Box
Hi Guys,

I have tried this - only have flash 5

Here is the fla - I have it working except when I roll on and off the textbox it fades in an out.


I only want it to fade when I click on it and click off it.


onClipEvent (load) {
this._alpha = 100;
alpha = no;
}
onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true) && (alpha == no)) {
this._alpha -= 13;
// this._alpha++ // very slow
// this._alpha*= 10 //a bit faster
alpha = yes;
} else if (alpha == yes) {
this._alpha += 13;
}
}
onClipEvent (load) {
}

http://www.actionscript.org/forums/a...=&postid=50155

Cheers,
SuzyQ

Replicating Website + Flash
Okay. Here is my predicament. My Father's company (Natural Herbal Prodicts) is paying some people a large sum of money to design a website. The design that they are stuck with is mediocre and not very functional and I could do a much better job, and would like to do so, except for this obstable. They are making a replicating website, that would be plugged into the already existing database system. Let me explain...


The original domain name will be www.entreneteam.com
Say I ordered, then a site would automatically be created after the order at the url
www.entreneteam.com/eric.html
Now say I give my card to someone with my url on it and they will get the same frontpage as anybody else, but when they order, they will be put under me in the distributor line so that their orders benefit me.
So these frontpages would be replicated like a tree and tied into the distributor database. Now, he already has a programmer that can take care of the database part, and tying the database into it, but I would still personally have to do the replicating webbsite part of it myself.

Now I have no idea how to do that, and will gladly research, but is this possible to do in Flash MX or in Flash MX and Cold Fusion, so that I could include the funtionability of a replicating website, with a good flash design?
I would really be helping my father out of a situation if I could do so.
Thanks for your time.

Replicating Website + Flash
Okay. Here is my predicament. My Father's company (Natural Herbal Prodicts) is paying some people a large sum of money to design a website. The design that they are stuck with is mediocre and not very functional and I could do a much better job, and would like to do so, except for this obstable. They are making a replicating website, that would be plugged into the already existing database system. Let me explain...


The original domain name will be www.entreneteam.com
Say I ordered, then a site would automatically be created after the order at the url
www.entreneteam.com/eric.html
Now say I give my card to someone with my url on it and they will get the same frontpage as anybody else, but when they order, they will be put under me in the distributor line so that their orders benefit me.
So these frontpages would be replicated like a tree and tied into the distributor database. Now, he already has a programmer that can take care of the database part, and tying the database into it, but I would still personally have to do the replicating webbsite part of it myself.

Now I have no idea how to do that, and will gladly research, but is this possible to do in Flash MX or in Flash MX and Cold Fusion, so that I could include the funtionability of a replicating website, with a good flash design?
I would really be helping my father out of a situation if I could do so.
Thanks for your time.

Replicating OnDragOver In Flash 5
Hi every1. First post, wondering if you can help me.

The deal is I've got an MC that I am dragging around my scene and I need other MC's to be highlighted as I drag over them, i.e. the mouse is still down. Buttons don't work, onClipEvent only runs once whilst mouseDown (so I can't do a continuous position check) and the only thing I can think of working is the onDragOver and onDragOut events in MX but I am using flash 5?

Any feedback welcome. Can't help feeling like am being very stupid, am sure this is possible, but can't for the life of me think how.

Cheers,
Sir.

Replicating Flash, Am Stuck :(
Hey,

I seen this flash thing. And i want to learn how the computer gets brought into it. Take a look here http://www.clipitsolutions.co.uk/flash/flashmovie.swf .. As soon as it starts, the computer comes in with like a cirle being tweened over it. But i dont understand how to do this?

If anyone could help, would be most greatful. I really wana learn this technique but its fryin my brain lol

Thanks,
Paul

Replicating Files On A Desktop In AS
Can i replicate files and create folders on a users desktop through actionscript?

Im creating a template builder that will have to replicate my swf's, write a variable to a html page where my flash is embeded, write a xml file, and create a folder on a users desktop with all the files above?

Is this possible in as or as3? Do I need to write my application in VB or flex instead?

Replicating HTML Forms
I am trying to put a HTML form into flash that has hidden fields. How can I put these in flash? Do I just set a variable value under the submit button function? Thanks!

Replicating Pages Turning
I'd like to replicate the turning of pages of a book, to show different information. I would either like (A) when you click on the lower right corner the page flips, flowing across the screen as if turning in real life or (b) *favorite* that when the lower right corner is dragged towards the left side, the page turns to the next. is this even possible? any help would be greatly appreciated (ps kinda new but my confidence and understanding is growing quickly)

Indications On Replicating Effect
Hello. I would like some indications on how to replicate the transition effect between the images on this site: link (the transition effect with the squares). Please offer some ideas on how to do that effect. As many indications as possible are welcomed. Thanks.

Replicating Pages Turning
I'd like to replicate the turning of pages of a book, to show different information. I would either like (A) when you click on the lower right corner the page flips, flowing across the screen as if turning in real life or (b) *favorite* that when the lower right corner is dragged towards the left side, the page turns to the next. is this even possible? any help would be greatly appreciated (ps kinda new but my confidence and understanding is growing quickly)

Replicating Left And Right Mouse Clicks
Was wondering whether anyone knows if it is possible to replicate a left and right mouse click in flash.

Need to distinguish between whether the user has right clicked their mouse or left clicked....also any ideas on replicating a double click?

Cheers....

Replicating The Menu On ERAIN Homepage.
The header bar of the Electric Rain webpage has a very nice effect when you rollover the buttons. I am just wondering if anyone knows how to re-create this effect. Also how to make the little pop-up bubble when rolled over the logo.

http://www.erain.com

Replicating This Effect With Bitmapfilter (Effects)
Hey there all, I'm just trying to replicate this effect

http://www.reactiondynamics.com/sd2.swf

using flash. So far, using Senoculars blurred trails example on his website, I've got this: blurtrail2.fla

Only, it doesn't look right and I'm not sure how I can get it looking better. For instance, how can I remove the spacing that appears as dots spin, and also, how do I elongate the trail, and make the blur falloff ? If it can't be done in flash, what program can I do it in?

Any help appreciated

Help Needed On Styling And Replicating Text Field
As a new AS3 coder I'm at a little bit of a loss on the most efficient way to replicate a styled text field.

I would like to use the following styled text info and load some text from an array. Do I need to create all this styling for every instance of the text in the array or can I create several new instances of the field in my function?

Thank you in advance for your help.


ActionScript Code:
var headlines:TextField = new TextField();var headline:TextFormat = new TextFormat();headline.size = 20;headline.font = new HelvBlack().fontName;headlines.alpha = 0;headlines.setTextFormat(headline);headlines.embedFonts = true;headlines.autoSize = TextFieldAutoSize.LEFT;

Replicating Photoshop Text Tool Antialiasing Settings In Flash 8?
Does anyone have any custom antialiasing settings to match up with the 4 settings: smooth, sharp, crisp and strong?

Thanks

Help With Efficient AS And XML
I have some code which currently works fine for getting the XML data in there, but I want to be able to duplicate my movie clips (resourceSlot_mc & dateSlot_mc) and load additional XMl data, if it is there.

How do I make this code more efficient for this task as well as for duplicating the movie clips?

Here is the code:


Code:
databaseXML = new XML();
databaseXML.ignoreWhite = true;

databaseXML.onLoad = function (success) {
if (success) {

// Populate the dateField with: <date month="Jan." day="14th" year="2004"> from the XML file.
dateSlot_mc.dateField.text += this.firstChild.firstChild.attributes.month +this.firstChild.firstChild.attributes.day +this.firstChild.firstChild.attributes.year;;

// Populate the resourceField with:
// <resource resourceName="John Smith"> from the XML file.
resourceSlot_mc.resourceField.text += this.firstChild.firstChild.firstChild.attributes.resourceName;

// Populate the projectIdField, clientField, projectField & timeField with:
// <project clientName="Client 1" projectID="Project001" projectName="Brochure"
// projectTime="8:00am - 12:00pm"/>
resourceSlot_mc.projectIdField.text += this.firstChild.firstChild.firstChild.firstChild.attributes.projectID;
resourceSlot_mc.clientField.text += this.firstChild.firstChild.firstChild.firstChild.attributes.clientName;
resourceSlot_mc.projectField.text += this.firstChild.firstChild.firstChild.firstChild.attributes.projectName;
resourceSlot_mc.timeField.text += this.firstChild.firstChild.firstChild.firstChild.attributes.projectTime;
} else {
dateField.text += "Loading Error!";
}
}
databaseXML.load("resource.xml");

More Efficient Way?
Hey, I have this function but its abit on the long side, and I want to add some more variables to it, so it will be even longer. Is there a more efficient way of writing this? Thanks for any help, Harro.

code: sendLatest = new LoadVars();
getLatest = new LoadVars();
sendLatest.sendAndLoad("php/latest.php", getLatest, "POST");
getLatest.onLoad = function() {
_global.latestone = getLatest.latest1;
_global.latesttwo = getLatest.latest2;
_global.latestthree = getLatest.latest3;
_global.latestfour = getLatest.latest4;
_global.latestfive = getLatest.latest5;
_global.latestsix = getLatest.latest6;
_global.latestseven = getLatest.latest7;
_global.latesteight = getLatest.latest8;
_global.latestnine = getLatest.latest9;
_global.latestten = getLatest.latest10;

_global.latestidone = getLatest.latestid1;
_global.latestidtwo = getLatest.latestid2;
_global.latestidthree = getLatest.latestid3;
_global.latestidfour = getLatest.latestid4;
_global.latestidfive = getLatest.latestid5;
_global.latestidsix = getLatest.latestid6;
_global.latestidseven = getLatest.latestid7;
_global.latestideight = getLatest.latestid8;
_global.latestidnine = getLatest.latestid9;
_global.latestidten = getLatest.latestid10;
gotoAndStop(2);

};

[CS3] What Is Better/more Efficient Would You Say?
Just asking opinions here, what does everyone think is better for OOP and what is more effecient to do?

To have each class control itself with an onEnterFrame event inside the class? e.g.

Code:
class A extends MovieClip
{
public function A()
{
this.onEnterFrame = whatever;
}
}

class B extends MovieClip
{
public function B()
{
this.onEnterFrame = whatever;
}
}
Or to have a main class, instantiate the subclasses, and then run update methods in those instances through a for loop in the main class? e.g.


Code:
class A extends MovieClip
{
public function A()
{
}

public function update()
{
//do stuff
}
}

class B extends MovieClip
{
public function B()
{
}

public function update()
{
//do stuff
}
}

class Main extends MovieClip()
{
public function Main()
{
//instantiate instances of A and B, and add them to some arrays for looping through
this.onEnterFrame = this.enterFrameHandler;
}

private function enterFrameHandler()
{
//loop through arrays of instances and run update() in them
}
}

[F8]/[CS3]Which Is More Efficient?
I'm working on a website with a flash header (pretty big one) and the content in PHP (html). I have a section about in the middle (flash as well, but half the width of the above header) of the page which displays the current promotions (featured products).

I can include this part either as a piece of the upper header and use wmode opaque and show on top with z-index (on the left and right side) the html menus OR have them as 2 separate, independent swf files (and i'm not reffering here to a loadMovie in the bigger, upper header, just another embed).

My question is which solution is better, especially if taking into consideration resource consumption especially but also bandwidth, time to load and eventual problems which could arrise?

Is This Efficient?
Im making a space arcade shooter. Generaly i have my enemy ships, but instead of making a bunch im just duplicating them. So every time they duplicate they add themselves to an Array called books (don't ask, i went too far to change it to anything else... heh).

The lasers that the player ship shoots has a constantly running for loop that runs through the Array to see if the laser is colliding with any object in the array (any of the enemies).

HOWEVER! im shooting only one laser in a stream right now. Later on i want to include powerups to add diff types of lasers and more#'s of them and the such.

Question is: If i have so many shooting later, that will be a lot of for loops right? so won't that slow everythign down? I want to know before i go too far.

Efficient?
onClipEvent(enterFrame) {
//y for horizontal walls
if(_root.wall1.hitTest(_root.player)){
setProperty(_root.player, _y, vLastY);
} else if(_root.wall2.hitTest(_root.player)) {
setProperty(_root.player, _y, vLastY);
} else if(_root.wall3.hitTest(_root.player)) {
setProperty(_root.player, _y, vLastY);
} else if(_root.wall4.hitTest(_root.player)) {
setProperty(_root.player, _y, vLastY);
} else if(_root.wall5.hitTest(_root.player)) {
setProperty(_root.player, _y, vLastY);
} else if(_root.gate1.hitTest(_root.player)) {
setProperty(_root.player, _y, vLastY);
} else if(_root.gate2.hitTest(_root.player)) {
setProperty(_root.player, _y, vLastY);
} else if(_root.gate3.hitTest(_root.player)) {
setProperty(_root.player, _y, vLastY);
} else if(_root.key1.hitTest(_root.player)) {
_root.gate1.gotoAndPlay(2);
_root.key1.gotoAndPlay(2);
} else if(_root.key2.hitTest(_root.player)) {
_root.gate2.gotoAndPlay(2);
_root.key2.gotoAndPlay(2);
} else if(_root.key3.hitTest(_root.player)) {
_root.gate3.gotoAndPlay(2);
_root.key3.gotoAndPlay(2);
} else if(_root.endlevel.hitTest(_root.player)) {
_root.gotoAndPlay(2);
}

// x for vert walls
if(_root.wallA.hitTest(_root.player)) {
setProperty(_root.player, _x, vLastX);
} else if(_root.wallB.hitTest(_root.player)) {
setProperty(_root.player, _x, vLastX);
} else if(_root.wallC.hitTest(_root.player)) {
setProperty(_root.player, _x, vLastX);
} else if(_root.wallD.hitTest(_root.player)) {
setProperty(_root.player, _x, vLastX);
}



if(Key.isDown(38)) {
//38 is down arrow
vlastY = getProperty(_root.player, _y);
vLocationY = getProperty(_root.player, _y);
setProperty (_root.player, _y, vLocationY -10);
}
if(key.isDown(40)) {
//40 is up arrow)
vlastY = getProperty(_root.player, _y);
vLocationY = getProperty(_root.player, _y)
setProperty (_root.player, _y, vLocationY +10);
}
if(key.isDown(37)) {
//37 is left arrow
vLastX = getProperty(_root.player, _x);
vLocationX = getProperty(_root.player, _x)
setProperty (_root.player, _x, vLocationX -10);
}

if(key.isDown(39)) {
//39 is right arrow
vLastX = getProperty(_root.player, _x);
vLocationX = getProperty(_root.player, _x)
setProperty (_root.player, _x, vLocationX +10);
}
}


that is the code i am using for this maze type game i am trying to make, and everything works great, but what i'm wondering is, if thats how you have to do it? so if i have 60 maze walls, i'm going to have to write 1 if statement and 59 else statements?

Which Is More Efficient?
Which is the most efficient method of loading data in: LoadVars, or LoadVariables?

I need to do a data driven (ASP + Access) Flash site, and was wondering which is the most efficient to use (mainly in terms of speed for visitors).

Thanks in advance

Is There A More Efficient Way?
Guys i need help with the following effect,

let's say i have 4 circular icons...on rollover i'd like to zoom in on them, well one at a time, and at the same time i want the other icons to be pushed out of the way (so they're all visible no matter how big the zoomed in overstate is (or how far apart they are from each other for that matter).

RageW0lf helped me a little bit... basically keeping every one of them at a distance (ActionScript:

if (mysymbol._xscale>100) {
this._x = mysymbol._xscale - 100 + 15;
}

With 5 or so buttons this can get really bulky i mean each of the buttons needs to know if the rolledOver button is on the left or right in order to slide to the right (+x) or left (-x)

Do you guys know a more efficient object oriented way of doing this. Help if you do or have any idea how to go about it ,

Thanks in advance,
Artom

More Efficient
I plan on making a portfolio of images for my site. I want to have a small thumbnail and a larger version of th image. When you roll over the thumbnail the large one pops up.
I know how to do this but I want to keep my file size to a minimum. So for those technically inclined out there here are a few questions.
Will loading Jpegs from external files be "much" slower than haveing a full sized jpeg in my library?
If I Keep my jpegs in my movie library is it more efficient to have the thumbnails made up from the orginal image (just shrink them down) or should I load in separate jpeg thumbnails.

Thanks guys

Most Efficient Way To Use A Bmp As A Bg
hi,

i am looking for some advice please. i want to make a flash site that will have 3 or 4 sfw files. each swf has the same background image that takes up all the movie.

it doesn't seem right to load it each time i load a new swf on a different level but i can't see how you set the bg to be transparent. ideally i think i should have a swf with the bg image on it and then that loads the content swf on top. then i could load and unload swfs.

what am i missing??

cheers

Efficient?
onClipEvent(enterFrame) {
//y for horizontal walls
if(_root.wall1.hitTest(_root.player)){
setProperty(_root.player, _y, vLastY);
} else if(_root.wall2.hitTest(_root.player)) {
setProperty(_root.player, _y, vLastY);
} else if(_root.wall3.hitTest(_root.player)) {
setProperty(_root.player, _y, vLastY);
} else if(_root.wall4.hitTest(_root.player)) {
setProperty(_root.player, _y, vLastY);
} else if(_root.wall5.hitTest(_root.player)) {
setProperty(_root.player, _y, vLastY);
} else if(_root.gate1.hitTest(_root.player)) {
setProperty(_root.player, _y, vLastY);
} else if(_root.gate2.hitTest(_root.player)) {
setProperty(_root.player, _y, vLastY);
} else if(_root.gate3.hitTest(_root.player)) {
setProperty(_root.player, _y, vLastY);
} else if(_root.key1.hitTest(_root.player)) {
_root.gate1.gotoAndPlay(2);
_root.key1.gotoAndPlay(2);
} else if(_root.key2.hitTest(_root.player)) {
_root.gate2.gotoAndPlay(2);
_root.key2.gotoAndPlay(2);
} else if(_root.key3.hitTest(_root.player)) {
_root.gate3.gotoAndPlay(2);
_root.key3.gotoAndPlay(2);
} else if(_root.endlevel.hitTest(_root.player)) {
_root.gotoAndPlay(2);
}

// x for vert walls
if(_root.wallA.hitTest(_root.player)) {
setProperty(_root.player, _x, vLastX);
} else if(_root.wallB.hitTest(_root.player)) {
setProperty(_root.player, _x, vLastX);
} else if(_root.wallC.hitTest(_root.player)) {
setProperty(_root.player, _x, vLastX);
} else if(_root.wallD.hitTest(_root.player)) {
setProperty(_root.player, _x, vLastX);
}



if(Key.isDown(38)) {
//38 is down arrow
vlastY = getProperty(_root.player, _y);
vLocationY = getProperty(_root.player, _y);
setProperty (_root.player, _y, vLocationY -10);
}
if(key.isDown(40)) {
//40 is up arrow)
vlastY = getProperty(_root.player, _y);
vLocationY = getProperty(_root.player, _y)
setProperty (_root.player, _y, vLocationY +10);
}
if(key.isDown(37)) {
//37 is left arrow
vLastX = getProperty(_root.player, _x);
vLocationX = getProperty(_root.player, _x)
setProperty (_root.player, _x, vLocationX -10);
}

if(key.isDown(39)) {
//39 is right arrow
vLastX = getProperty(_root.player, _x);
vLocationX = getProperty(_root.player, _x)
setProperty (_root.player, _x, vLocationX +10);
}
}


that is the code i am using for this maze type game i am trying to make, and everything works great, but what i'm wondering is, if thats how you have to do it? so if i have 60 maze walls, i'm going to have to write 1 if statement and 59 else statements?

Is There A More Efficient Way?
Guys i need help with the following effect,

let's say i have 4 circular icons...on rollover i'd like to zoom in on them, well one at a time, and at the same time i want the other icons to be pushed out of the way (so they're all visible no matter how big the zoomed in overstate is (or how far apart they are from each other for that matter).

RageW0lf helped me a little bit... basically keeping every one of them at a distance (ActionScript:

if (mysymbol._xscale>100) {
this._x = mysymbol._xscale - 100 + 15;
}

With 5 or so buttons this can get really bulky i mean each of the buttons needs to know if the rolledOver button is on the left or right in order to slide to the right (+x) or left (-x)

Do you guys know a more efficient object oriented way of doing this. Help if you do or have any idea how to go about it ,

Thanks in advance,
Artom

Is There A More Efficient Way Than This...?
I have a movie with three navigation tabs. These tabs all have the same behaviours. The code I have written works perfectly well, but it just isn't very elegant. There must be a better way than the way I have done it.

Can anyone help me by showing me a more efficient way to code this? :-
CODE//-----------define all button actions-----------------

tab01.onRollOver = function() {
    moveTab(tab01, moveSpeed);
};
tab01.onRollOut = function() {
    returnTab(tab01, moveSpeed);
};
tab01.onPress = function() {
    colourTab01.setTint(255, 0, 0, clickShade);
};
tab01.onRelease = function() {
    colourTab01.setTint(0, 0, 0, 0);
    gotoAndStop("tab01");    
    interaction(1);    
};


tab02.onRollOver = function() {
    moveTab(tab02, moveSpeed);
};
tab02.onRollOut = function() {
    returnTab(tab02, moveSpeed);
};
tab02.onPress = function() {
    colourTab02.setTint(255, 0, 0, clickShade);
};
tab02.onRelease = function() {
    colourTab02.setTint(0, 0, 0, 0);
    gotoAndStop("tab02");
    interaction(2);
};

tab03.onRollOver = function() {
    moveTab(tab03, moveSpeed);
};
tab03.onRollOut = function() {
    returnTab(tab03, moveSpeed);
};
tab03.onPress = function() {
    colourTab03.setTint(255, 0, 0, clickShade);
};
tab03.onRelease = function() {
    colourTab03.setTint(0, 0, 0, 0);
    gotoAndStop("tab03");
    interaction(3);
};

//-----------------end button actions---------------------

More Efficient Way?
There has got to be a more effecient way of writing this:


ActionScript Code:
chart_btn._alpha = 0;
slider_btn._alpha = 0;
crosstab_btn._alpha = 0;
chart_btn.onRollOver = function() {
    this._alpha=100;
}
chart_btn.onRollOut = function() {
    this._alpha=0;
}
slider_btn.onRollOver = function() {
    this._alpha=100;
}
slider_btn.onRollOut = function() {
    this._alpha=0;
}
crosstab_btn.onRollOver = function() {
    this._alpha=100;
}
crosstab_btn.onRollOut = function() {
    this._alpha=0;
}


Sandman9

Which Is More Efficient?
I have an XML onLoad event that reads loads data into a data object. Is there any difference in efficiency between having the XML handler set the property directly or calling a method on the object that sets the property?

Which Syntax Is More Efficient?
Someone has told me that the slash syntax is much more efficient than dot syntax? And just the same that tellTarget runs faster than with.
Is it true?

How Can I Make This More Efficient?
Help! Check this out: http://simonabrams.com/drawing/paint_test.swf

I'm having a couple of problems with this movie. I need to do two things:

1) Add a "crayon" as a cursor, and make the circle that is the "brush" invisible

2) I need to make this so it doesn't slow down to a crawl after playing with it for a while.

Basically, I need to make it look like the user is picking up a crayon, and gets to color in the image (one crayon magically colors in all the colors of the image).

Any ideas? By the way, this thing is based on the "Draggable Magnifying Glass by The Freehand Site (available as an extension from Macromedia), and the "simple airbrush" I found somewhere within these boards. The .fla file is in http://simonabrams.com/drawing/

Thanks, guys.

- Simon
[Edited by flysi on 02-05-2002 at 07:46 PM]

A More Efficient Animation
I have several pict files and type in a movie I'm making. Will the movie player file run better if I break apart the picts and the text before exporting it or doesn't it matter. I seem to notice some speed issues and I'll break them apart if it will help.

Wondering What Would Be Efficient
Have several layers, one has an emblem, another has buttons, and another has visible paths for a "windy" effect that the buttons will follow. I must have the paths above the emblem layer. Then I would like the buttons on top of the paths layer, but I would like the buttons to appear to come from behind the emblem. Does anyone have suggestions? I was thinking that I could use AS to rearrange the layers but thought I might be making something fairly simple into a mess. I am fairly new to this so it would help if you talked to me like I am 5.
Thanks for any time, help and knowledge,
Va

More Efficient Coding
Hi guys,

I'm trying to learn to code a bit more efficient. But I am afraid need some help.

In the following code

a card is mc, consisting of a rectangle, with a textfield inside wich gets its text from an array, named card1, card2 etc.

15 targets ( 5 rows of 3) are on the stage, named T1a, T1b, T1c, T2a, T2b etc.



First one:

this is the code I use now:

* * *

// move card1
card1.onPress = function () {
this.startDrag();
};
card1.onRelease = function () {
this.stopDrag();
};
card1.onReleaseOutside = function () {
this.stopDrag();
};
// end

* * *

As I have 15 cards, I need to repeat this 15 times. Each card will hold text which it gets from an array. I have the cards on the stage at the beginning of the movie (yes my next thing is I will try to do a while loop with a duplicateMovie)


Second one, which gives me more headaches:

This code works fine, but will get very long if I have to do it for 15 cards and 15 targets (this is for three cards and three targets):

* * *

// snap card1 to target on Mouse up
card1.onMouseUp = function() {
// check if two card or on the same place, if so move it.
if (this.hitTest(card2)) {
card1._x = 50;
card1._y = 50;
}
if (this.hitTest(card3)) {
card1._x = 50;
card1._y = 50;
}
// check if this card hits a target, if so, snap
if (this.hitTest(T1a)) {
this._x = T1a._x;
this._y = T1a._y;
trace (card1._y);
} else if (this.hitTest(T1b)) {
card1._x = T1b._x;
card1._y = T1b._y;
trace (card1._y);
} else if (this.hitTest(T1c)) {
card1._x = T1c._x;
card1._y = T1c._y;
trace (card1._y);
}
};
// end

* * *

At the first bit I kept getting errors on this code:

if (this.hitTest(card2)) OR (this.hitTest(card3)) {
card1._x = 50;
card1._y = 50;
}

This especially gives me headaches. I encountered the same problem trying use something similar with && / AND.

Thanks a LOT,

Papermouse

Efficient Coding
I'm trying to find an efficient way to test what hit a MC...

I have an action in a MC on its frame to test for a hittest on 5 different objects...like this

Code:
if(_root.blah1.hitTest(this)||_root.blah2.hitTest(this)||_root.blah3.hitTest(this)||_root.blah4.hitTest(this)||_root.blah5.hitTest(this))
{
something something;
}


and now that i got other things working , i am coming back to this and trying to make it like this...

Code:
if(_root.blah1.hitTest(this))
{
blah1.gotoAndStop("Something");
}

but i dont wanna do an if for each blah MC... because then i have to do it again... so that would be 10 ifs... I was just wondering if anyone knew how to do this an easier way..Anyone?, i though maybe a switch statement... but i have no clue how that would work.... Please help...thanks,

Peace,
~Bill

Most Efficient Method
Hi. I am creating a tile-map based game in Flash sort of like Chip's Challenge. When you start the game, the first level loads and then you play that level. Then the second level loads and you play that level. Same with the third, fourth, etc. I am trying to make the shortest load times possible, since it will be played over the internet (by a lot of dial-up users). So what would be the best way to store my tiles for the levels? A lot of the same tiles will be used throughout various levels, but not every level needs ALL the tiles.

Each level is it's own SWF, so I COULD put only the tile images used in each level in it's SWF, but since some of those tiles are used in other levels, it seems kinda of a waste to have to duplicate them in a future level's SWF. I thought that I could put all the tiles in a shared library and then just pull the ones I needed in each level, but then I discovered that it will load ALL of that shared library and not JUST the symbols I need. I am trying to cut down on loading time as much as possible. Does anyone have any ideas what I could do?

Efficient Comparison
Is there a more efficient way to write this?
code:
m = 6;
if((m == 3) || (m == 6) || (m == 9)){
trace("it's in there");
} else { trace("sorry, it is not in there");}

Thanks.

If Else Dilemmas - More Efficient Way?
Currently I'm using an actionscript on a button, after the user has entered some data in the input text boxes.

There must be a more efficient way of doing it. Somebody mentioned the possibility of using an array, rather than six separate if...else statements, but I don't know how to do it.

Also, the (else) segment doesn't seem to be working properly. If the user doesn't enter a name, then it returns the box as blank, rather than with the (if) section of the statement.

Can anybody offer a suggestion or two? Most appreciated. Please note I have limited ActionScript knowledge, so as much detail as possible would be good.


on (release, keyPress"<Enter>") {
gotoAndStop(10);

if (Fairy=="") {
FairyMsg = "You did not choose a name for the fairy. The default name is Bella-Rose.";
} else {
FairyMsg = + Fairy + " for the fairy";
}

if (JB1=="") {
JB1Msg = "You did not choose a name for the first jitterbug. The default name is Jub-Jub.";
} else {
JB1Msg = + JB1 + " for the first jitterbug";
}

if (JB2=="") {
JB2Msg = "You did not choose a name for the second jitterbug. The default name is Dot.";
} else {
JB2Msg = + JB2 + " for the second jitterbug";
}

if (JB3=="") {
JB3Msg = "You did not choose a name for the third jitterbug. The default name is Lily.";
} else {
JB3Msg = + JB3 + " for the third jitterbug";
}

if (Kingfisher=="") {
KingfisherMsg = "You did not choose a name for the kingfisher. The default name is Jonathan."
} else {
KingfisherMsg = + Kingfisher + " for the kingfisher"
}


if (FairyPrince=="") {
FairyPrinceMsg = "You did not choose a name for the fairy prince. The default name is Frederic."
} else {
FairyPrinceMsg = "and " + FairyPrince + " for the fairy prince."
}
}

More Efficient Function
Can anyone help me make this code more elegant, or suggest another way of doing it?

It is a multiple response question, but the answers all need to be concatentaed into one big string before they are sent, they cannot be sent one at a time
aOn is set when the button for a particular response is clicked, 1=on, 0=off, sendAnswer is called whenever the button is clicked(either on or off)

Cheers.


sendAnswer = function() {
if (aOn==1){
aAns="this is answer a, "
}else{
aAns=" "
}
if (bOn==1){
bAns="this is answer b, "
}else{
bAns=" "
}
if (cOn==1){
cAns="this is answer c, "
}else{
cAns=" "
}if (dOn==1){
dAns="this is answer d, "
}else{
dAns=" "
}if (eOn==1){
eAns="this is answer e, "
}else{
eAns=" "
}if (fOn==1){
fAns="this is answer f, "
}else{
fAns=" "
}if (gOn==1){
gAns="this is answer g, "
}else{
gAns=" "
}if (hOn==1){
hAns="this is answer h. "
}else{
hAns=" "
}

answer = aAns + bAns + cAns + dAns+ eAns + fAns + gAns + hAns
trace(answer);
}

How Can I Make This More Efficient
Here is a menu which is part of a much larger fla.

How can I make the scripting more efficient? A good start would be to stop the MCs from calling when not moving, and top two menu items contain different code from my (failed) attempts at solving the problem.

I am using MX.

thanks to all

I Want To Make This More Efficient
Does anyone know a way to streamline this?
its area reset button for a whole bunch of MC (total of 70)
this is just a section.
so on release I want to send the MCs back to their origins. this does it, but its hell to code.

any effeciency advice?
==============================

_root.reset_btn.onRelease = function (){


_root.word0._x=26.1;
_root.word0._y=133.9;
_root.word1._x=26.1;
_root.word1._y=170.1;
_root.word2._x=26.1;
_root.word2._y=206.3;
_root.word3._x=26.1;
_root.word3._y=241.9;
_root.word4._x=26.1;
_root.word4._y=277.5;
_root.word5._x=26.1;
_root.word5._y=313.1;
_root.word6._x=26.1;
_root.word6._y=369.9;
_root.word7._x=26.1;
_root.word7._y=403.9;
_root.word8._x=26.1;
_root.word8._y=437.8;


Thanks in advance.

Mark

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