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








Any Way Around The Loop Error (loading 8000 Vars, Flash Thinks Its A Loop.)


I have 8000 vars to load....... all at once, so Flash thinks its in a loop at the 3000 mark and gives an error. Is there any way around this?




FlashKit > Flash Help > Flash ActionScript
Posted on: 06-03-2005, 08:31 PM


View Complete Forum Thread with Replies

Sponsored Links:

Help, Flash Thinks It's A Endless Loop
I'm working on an apllication that takes variables from a form, puts them into an array and them sorts everything in some way. I did most of the project on a scaled-down version, to make it easier to debug. Now, when I added all the data, I can't compile it anymore. From the form, will result 5 x 5 arrays, each with 7 elements. Then, through 5 nested loops I concatenate the arrays to get all the combinations: [00000,00001,00002 ... 55555]. I should end up with an array of 3125 elements (5 to the power 5), each containing an array of 5 elements, each containing 7 elements. A grand total of 109375 elements. It's a biggy! It is clear to me that Flash connot handle it, at least not with the current design. Any suggestions? The nested loop is bellow.

function append(array1, array2, array3, array4, array5)
{
var z=0;
for(i=0; i<array1.length; i++)
{
for(j=0; j<array2.length; j++)
{
for(k=0; k<array2.length; k++)
{
for(l=0; l<array2.length; l++)
{
for(m=0; m<array2.length; m++)
{
result_array_append[z]=array1.concat(array2[j],array3[k],array4[l],array5[m]);
z++;
}
}
}
}
}
return result_array_append;
}

View Replies !    View Related
Loading Vars From Port 8000?
hi there

i have written a server that runs on port 8000...
how can i POST variables to this server? GET seams not to make any problems... POST does... any ideas?

View Replies !    View Related
Flash Vars With A Loop
I have a little test program that takes in flashvars and displays them in a text box.

I input the valuse by putting

'flashvars', 'varInputs=3&varIn1=1&varIn2=2&varIn3=3'

in the AC_FL_RunContent() on the html page.

----

The code at the bottom of this post, does what I want, but I want to know how to use a loop to get the data. under the code that works I show one way that I tryed to make a loop, but it didn't work.














Attach Code

//-------------------------Start: code that works------------------
var temp;
var varInputs = root.loaderInfo.parameters.varInputs;

temp = root.loaderInfo.parameters.varIn1;
txtMyText1.text =temp;

temp = root.loaderInfo.parameters.varIn2;
txtMyText2.text =temp;

temp = root.loaderInfo.parameters.varIn3;
txtMyText3.text =temp;


txtMyText.text =varInputs;
//-------------------------End: code that works------------------



//-------------------------Start: code that doesn't work------------------
var temp;
var varInputs = root.loaderInfo.parameters.varInputs;
txtMyText.text =varInputs;

for(n=1;n<=3;n++){
temp = root.loaderInfo.parameters.varIn+n;
txtMyText+n.text =temp;
}
//-------------------------End: code that doesn't work------------------

























Edited: 07/18/2008 at 01:37:44 PM by rhythmicCycle

View Replies !    View Related
[F8] Loading Script Getting Ininite Loop Error
This is actually a 2 part question and probably has an easy solution. I'm using actionscript 2.0.

code: onEnterFrame = function () {
bytes_loaded = Math.round(_root.getBytesLoaded());
bytes_total = Math.round(_root.getBytesTotal());
getPercent = bytes_loaded/bytes_total;
_root.preloader_mc.loaded_txt.text = Math.round(getPercent*100)+"%";

if (bytes_loaded == bytes_total) {
_root.gotoAndPlay(3);
delete onEnterFrame();
}
}


I'm getting this error.
"256 levels of recursion were exceeded in one action list.
This is probably an infinite loop.
Further execution of actions has been disabled in this movie."

Any idea?

Also, this is a movie that is going to be loaded in to another movie using loadMovie. Will this cause the loading script to act differently if it's in another movie.
Thanks

View Replies !    View Related
Loading 8000 External Jpegs Into Flash
If I have about 8000 jpegs (1024x768) to play in flash, is there any kind of solution to this?

I've tried bitmap data/ bitmap cache but the tutorials I've seen so far involves buttons. What if I want to let it play frame by frame by itself? like a slideshow?

View Replies !    View Related
Loading 8000 External Jpegs Into Flash
If I have about 8000 jpegs (1024x768) to play in flash, is there any kind of solution to this?

I've tried bitmap data/ bitmap cache but the tutorials I've seen so far involves buttons. What if I want to let it play frame by frame by itself? like a slideshow?

View Replies !    View Related
Calculating Value In A Loop-my Error Or Flash Bug
hello,
I'm making a mvc Picture Gallery class where I use Ladislav's tween prototypes. I am using an alphaTo tween method to show loaded pictures on stage but the clips don't show up. I found out in Ladislav's tweenManager class - addTween() method the following issue:

var ch=pEnd[i] - mc[pp]
trace("val1= "+pEnd[i])//output: val1= 50
trace("val2= "+mc[pp])//output:val2=29.6875
trace("CH= "+ch)//output: CH= NaN


var ch is not computed although both, pEnd[i] and mc[pp], are numbers that show up in the output window (I also used casting: Number(pEnd[i]) ) !!!

I really don't know what's wrong here so I need your help, because this is driving me crazy!

thanks.

View Replies !    View Related
Flash Script/Loop Error
Hi all.
I made this site.
www.puredv.com

On my mac and pc it loads fine, but I am getting client complaints that when it first loads too the screen, it gets stuck in a loop, like some sort of script error.
Does anyone know the cause of something like this?
It's strange how it works on some mac's and some pc's, but not others.
Help is always appreciated.
Thanks

View Replies !    View Related
Vars In For-loop
I know this won't work, but it's to explain what I want to do.

for(i=0; i<20; i++) {
"_root.op_over.uiteindelijk.scrollgedeelte.onderwe rp_"+i="_root.onderwerp_over_"+i;
}

Can anybody give me advice how I can make this work ?

View Replies !    View Related
Changing MC Vars In A Loop...
Basically i need to change multiple movie clips ( for example, blah1, blah2, blah 3.... blah99 ect... ) in a for loop without using getVariable() function.

I *think* i used to use something like this back in flash mx(6):
for ( i = 0; i < numberOfBlahs; i++ )
{
["blah"+i].someVariable = Math.random();
}

And i think you get the idea. So does anyone have any idea?

I tried getVariable( "blah" + i, variable ) but the variable can only be the usual default mc vars like _x, _y and so on.. it has a sad if i use different ones.

View Replies !    View Related
Creating Vars With Loop
I am trying to save myself some time by creating a loop that makes variables. I have tried several different ways but none work. This is what I have tried:

Code:
//Attempt 1
for (v = 1; v <= 40; v++){
var this["s"+v+"Owner:Number"] = 0;
}
//Attempt 2
for (v = 1; v <= 40; v++){
this["var s"+v+"Owner:Number"] = 0;
}
//Attempt 3
for (v = 1; v <= 40; v++){
this["var s"+v+"Owner"]:Number = 0;
}
//Attempt 4
for (v = 1; v <= 40; v++){
var this["s"+v+"Owner"]:Number = 0;
}

I am trying to make a variable called s(number)Owner. How can this script work?

View Replies !    View Related
Generating Vars In A Loop
How do you create variables on the fly in a loop:

for(var i=0;i<18;i++){
trace(i);

var name+i = i;//of course this doesn work...


}

i want result to be a bunch of vars like so:
name0 = 0;
name1 = 1;
etc...
name17 = 17;

any help is appreciated.

View Replies !    View Related
Dynamic Vars In For Loop
Hi, I have created a movieclip. This movieclip will have 5 child Sprite's, which will contain an image pulled from xml.

I want to create a for loop to create those 5 Sprite's, add the appropriate image into each one (i.e., img[0] into sprite[0]) and then add each sprite to the movieclip.

Here is how I'm failing to do it...


ActionScript Code:
//    var xmlImgHolder_1:Sprite = new Sprite();
//    var xmlImgHolder_2:Sprite = new Sprite();
//    var xmlImgHolder_3:Sprite = new Sprite();
//    var xmlImgHolder_4:Sprite = new Sprite();
//    var xmlImgHolder_5:Sprite = new Sprite();
       
        for (var i:uint = 0; i < xmlData.length; i++){
            var xmlImgHolder_[i * 1]:Sprite = new Sprite();
        }

is there another way?

OR... perhaps can I create 1 Sprite, instantiate it and call it by name?

View Replies !    View Related
Individual Vars In Loop?
I've created a loop to define onPress functions for a group of movieclips. The code is here:

Code:
var select:String = "none";
var elist:Array = ["dappled", "panda", "red", "blue", "green", "gray", "fire", "earth", "water", "garden"];
for (i=0;i<elist.length;i++) {
var cur:String = elist[i];
[cur]onPress = function(){
select = cur;
trace(select);
};
}
All the mcs now have an onPress function. However, they all define the "select" variable as the last item in the array. Is this because every mc is referencing the new curs? I'm not really sure... Is there a way I can fix this so select is given the correct (unique) value every time?

View Replies !    View Related
Declare Vars In For Loop For Root
Hey guys, I'm trying to declare 8 vars, but without writing:

ActionScript Code:
var s1:Sound;
var s2:Sound;
var s3:Sound;
var s4:Sound;
var s5:Sound;
var s6:Sound;
var s7:Sound;
var s8:Sound;

or


ActionScript Code:
var s1:Sound,s2:Sound,s3:Sound,s4:Sound,var s5:Sound,s6:Sound,s7:Sound,s8:Sound,

This would be fine for the example, but I'm planning on using the technique for much bigger things.

For the example I want to load 8 songs into these generated vars.

That's fine, but I want to access them elsewhere in the script and/or timeline. So I have a scoping issue. Is there a way to declare a var UP a level?

So what I want to do is something like:


ActionScript Code:
for (var i:Number = 0; i<8; i++){
         var this['s'+i]:Sound = new Sound;
         this['s'+i].loadSound('sounds' + i + '.mp3');
         this['s'+i].stop();
}

Obviously that code does not work because of the var declaration, but I can't figure out how to declare multiple vars in one loop.

So my questions are:

1: How to declare multiple vars in one loop.
2: How to make them accessible to the root, or outside it's scope.

View Replies !    View Related
Flash Not Acknowleging Loop- Probably Just A Syntax Error... Need Quick Reply..
heres the code- (EDIT: FIXED CODE- SCROLL DOWN TO SEE PROBLEM #2!!!)


Code:
_root.loopout=false;
_root.cyclinchoicex == -1
do {
if (_root.cyclinchoicex != -1) {
_root.cyclinchoicex = -1;
_root.cyclinchoicey = -1;
_root.loopout = true;
}
} while (_root.loopout==false);
trace(3*2);


for somereason, its going straight through the loop... chyclinchoicex changes when a button is pressed to "1", or "0" if mouse hits outside it... debug says that the mouse is registering fine, its the loop thats going through... no syntax error, but i probably mistyped something... a quick answer is probably wut i'll get and is wanted... quickly...

View Replies !    View Related
Loop Error?
I am making mancala. But for the first player, sometimes the marbles will not go into the following pots. I have attached the fla. THe first player's side is on the side closest to you. The functions are on the very first frame. Click on a pot to move it's marbles.
Mancala.fla

View Replies !    View Related
[AS2] New XML() In Loop Error
Hi there,

(Code: AS2)

I've written the below script. Basically, I set out wanting to make a reusable piece of code that would take the names of some xml files (as listed in the cats array), and to cycle through each file, loading the XML data into the kitties object. Then, once the info had loaded, it goes through the cat nodes, and creates a new Cat object from them.

This works great if I just use one file i.e. just new Array("moggies.xml").

But, if I use more than one, the code whizzes through, ignores the onLoad section and only bothers to apply the load and onLoad to the final file in the array. It's as if doesn't wait for the XML to load until the last moment. The XML files are all valid and work fine.

The below code outputs:

Currently on: persians.xml
Currently on: moggies.xml
Currently inside: moggies.xml
Currently inside: moggies.xml
Created new moggies called moggies0 with the filename flump.jpg
Created new moggies called moggies1 with the filename bozo.jpg
Created new moggies called moggies2 with the filename mogz.jpg
Created new moggies called moggies3 with the filename missy.jpg

Any help would be much appreciated.


Code:
var cats:Array=new Array("persians.xml","moggies.xml");

for(var i:Number=0; i<cats.length; i++)
{
var file:String=cats[i];
var kitties:XML=new XML();
kitties.ignoreWhite=true;
trace("Currently on: "+file);
kitties.onLoad=function(success:Boolean)
{
trace("Currently inside: "+file);
if(success)
{
var kitties_size:Number=kitties.firstChild.childNodes.length;
var type:String=kitties.firstChild.nodeName;
for(var j:Number=0;j<kitties_size;j++)
{
var nname:String=type+j;
var fname:String=kitties.firstChild.childNodes[j].attributes.filename;
var iname:String=kitties.firstChild.childNodes[j].attributes.name;
var nname:Object=new Cat(type,nname,iname,fname);
}
}
}
kitties.load(file);
}


As an example of the moggies.xml sheet, it looks like this:


Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<moggies>
<image name="Flump" filename="flump.jpg" />
<image name="Bozo" filename="bozo.jpg" />
<image name="Mogz" filename="mogz.jpg" />
<image name="Missy" filename="missy.jpg" />
</moggies>

View Replies !    View Related
Error Upon Flv Loop
I am using the following AS3 code to loop an flv

import fl.video.VideoEvent;
homePlayer.addEventListener(VideoEvent.COMPLETE, videoLoop);

function videoLoop(event:Event)
{
homePlayer.play();
};


Here is what is happening. The script works well and I am using it for 4 different instances of the flvPlayBack component. After it loops the on the opening instance and you navigate to another the initial instance throws the following error and stops looping ... this also seems to be causing a problem with the playback on all instances except the open instance in Firefox and IE6 .. both of which I have to accomodate with this project. At any rate ... here is the error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Project_fla::MainTimeline/videoHome()[Project_fla.MainTimeline::frame1:20]
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunctio n()
at flash.events::EventDispatcher/dispatchEvent()
at fl.video::FLVPlayback/http://www.adobe.com/2007/flash/flvplayback/internal::handleVideoEvent()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunctio n()
at flash.events::EventDispatcher/dispatchEvent()
at fl.video::VideoPlayer/http://www.adobe.com/2007/flash/flvplayback/internal::httpDoStopAtEnd()
at fl.video::VideoPlayer/http://www.adobe.com/2007/flash/flvplayback/internal::httpNetStatus()

My client is unable to view any of the flv playback instances except for the opening instance.

View Replies !    View Related
Error Upon Flv Loop
I am using the following AS3 code to loop an flv

import fl.video.VideoEvent;
homePlayer.addEventListener(VideoEvent.COMPLETE, videoLoop);

function videoLoop(event:Event)
{
homePlayer.play();
};


Here is what is happening. The script works well and I am using it for 4 different instances of the flvPlayBack component. After it loops the on the opening instance and you navigate to another the initial instance throws the following error and stops looping ... this also seems to be causing a problem with the playback on all instances except the open instance in Firefox and IE6 .. both of which I have to accomodate with this project. At any rate ... here is the error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Project_fla::MainTimeline/videoHome()[Project_fla.MainTimeline::frame1:20]
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at fl.video::FLVPlayback/http://www.adobe.com/2007/flash/flvplayback/internal::handleVideoEvent()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at fl.video::VideoPlayer/http://www.adobe.com/2007/flash/flvplayback/internal::httpDoStopAtEnd()
at fl.video::VideoPlayer/http://www.adobe.com/2007/flash/flvplayback/internal::httpNetStatus()

My client is unable to view any of the flv playback instances except for the opening instance.

View Replies !    View Related
Weird For Loop Error...
This is the error I get:
Symbol=Rack Builder, Layer=actions, Frame=10: Line 23: ';' expected
for (2count = 0; 2count < this["equip" add count add "cardCount"]; 2count++){


Now where exactly in there is there a ";" out of place or missing?

(It's nested in another for loop, but I've checked all the ";" and """ and ")" marks, they're all in the right place.)

View Replies !    View Related
Infinite Loop Error
I was coding what I thought was a great and smart morphing interface. This is what the output window thru up at me, when testing the final step:


256 levels of recursion were exceeded in one action list.
This is probably an infinite loop.
Further execution of actions has been disabled in this movie.



any comments, or other out-of-this-world experiences like this?

View Replies !    View Related
[F8] Infinite Loop Error
Can somebody tell me what is wrong with this code? It causes an infinite loop as I try to combine the Alert box and the combobox...! Help much appreciated!


Code:
var cmb_listener:Object = new Object();
cmb_frekvens_listener.change = function(evt_obj:Object)
{
var currentlySelected:Object = evt_obj.target.selectedItem;

// Flasher Alert: Define action after alert confirmation.
var alert:Function = function (evt_obj:Object)
{
if (evt_obj.detail == Alert.OK)
{
trace ("New data: " + currentlySelected.data);
trace ("New label: " + currentlySelected.label);
}

else
{
trace("Cancel pressed!");
}
};

// Show alert dialog box.
var warning_header:String = "Confirm!";
var warning:String = "blah blah";
var myAlert:Object = Alert.show(warning, warning_header, Alert.OK | Alert.CANCEL, null, alert, "Utropstegn", Alert.OK);

};

cmb_frekvens.addEventListener("change", cmb_listener);

View Replies !    View Related
Help Catching Error Mid Loop
Hi,

I'm loading a whole load of pictures from amazon s3.

If the image cant be found I'd like to just display a default image. If you look at my code you'll quickly see what my problem is.

The image loading takes place within a numeric loop. Each iteration of the loop is used as a unique index number for my application.

I first off thought "oh grand, I'll stick code for the instance that an image isnt found in the IOError handler". But then I realized that the index number would be lost.

Could somebody help me figure a way to handle the error and keep my indexing?


ActionScript Code:
private function Load_thumbnail():void
        {
           
           
            var context:LoaderContext = new LoaderContext();
           
            context.checkPolicyFile = true;
           
            var myRequest:URLRequest;      
       
            for (var i:uint = 0; i<numphot; i++)
            {

                var myLoader:Loader = new Loader();
           
                myRequest = new URLRequest(thumb[i]);
   
                   
               
       
                myLoader.load(myRequest,context);
                myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, Thumb_loaded);
                myLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
                pInfor[myLoader] = i;
               
               
            }
           
        }
       
        private function ioErrorHandler(e:IOErrorEvent){
                test.text=String(e)
            }

View Replies !    View Related
For Loop Condition Error
I am using the function below in a 3d rendering program I am making. It is supposed to return the matrix product of two matrices entered into it, reffered to as A and B, as arrays (I already know that as written it would not return the matrix product accurately- I need to fix another problem first). When I run the code, absolutely nothing happens. Does anyone have any idea of why?


ActionScript Code:
function matrixProduct(A:Array, B:Array):Array{
    var C:Array = new Array()
    var i:Number
    var j:Number
    var k:Number
    if (A[0].length == B.length){
        for(i = 0; C.length + 1 <= B.length; i ++){
            if(C[i] == undefined){
                C[i] = new Array(0)
            }
            for(j = 0; C[i].length <= A[i].length; j ++){
                if(C[i][j] == undefined){
                    C[i][j] = 0
                }
                C[i][j] += A[i][j] * B[j][i]
            }
        }
    }
    return(C)
}
var a:Array = new Array()
a[0] = new Array(1, 2)
a[1] = new Array(3, 1)
var b:Array = new Array()
b[0] = new Array(2, 3)
b[1] = new Array(5, 2)
trace(a)
trace(b)
trace(matrixProduct(a,b))

View Replies !    View Related
Maximum Loop Error
Hi All,

I got an error message while publishing a file:
**Warning** com.mapper.LinkMapper: Branch between 10161 and 43877 exceeds 32K span.

The "LinkMapper" class formats an XML with 5 Nested Loops:-(
I checked the swf metada file usig some third party tools also, it says some branches are missing(The same number came shown in the above error code).

The xml is huge, but in no way I can drop any nodes.So please tell me any workarounds to avoid such an error.I have been working in flash for som time...but never got such error.
Thanks And Reagrds.

View Replies !    View Related
For Loop Syntax Error
Hello All,
I have 62 movieclips on stage and just want to let them play when they are hit by radar_mc. I have coded it the long way and works fine. Just trying to optimize everything in a for loop and I am having problems with syntax. Not sure what I should declare variable as or if I am headed in the right direction.
Any help appreciated.
Regards

stop();
//Imports
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
//Declare Tweens
var moveRadar:Tween;

//Move Radar Blip Left to Right
moveRadar = new Tween(radar_mc, "x", None.easeNone, -20, 1000, 120, false);

radar_mc.addEventListener(Event.ENTER_FRAME, goBlip);

function goBlip(event:Event):void {
for (var i:Number =1; i<63; i++) {
var clip = "blip"+i+"_row1_mc";
if (radar_mc.hitTestObject(clip)) {
clip.gotoAndPlay("start");
}
}
}

View Replies !    View Related
AS 2.0 For Loop Syntax Error?
Hello everyone.

For some reason no matter how many time i write a for loop, i seem to always run into issues tracking the instances. Ive recently been trying to learn the new syntax for AS 2.0 so i am trying to write a loop to attach some movieClips to the stage in an orderly fashion.

The code I have is as follows:

Code:
//create a "container" clip for the movies
this.createEmptyMovieClip("players_mc", this.getNextHighestDepth());
var player:MovieClip;

for(var i:Number = 0; i<14; i++){
//linkage identifier is "playerB_mc"
player = this.players_mc.attachMovie("playerB_mc", "player"+i, this.getNextHighestDepth());
//amount to offset _x each time a clip is place
var xIndent:Number = player._x + player._width
//tracing "104" every iteration
trace(xIndent);
if(i == 0){
player._x = 0;
player._y = 0;
} else if (i>0 && xIndent < (Stage.width - 5)){
player._x += player._width;
} else {
player._x = 0;
player._y += player._height;
}
}

Can anyone help point me in the right direction?
Thanks in advance.

View Replies !    View Related
Loading Vars Error
Hello

I am trying to load a movie into flash using an asp file to get the names of the url. the start will be "WEB_ADDRESS" and then it will add a the end using script.


Code:
loadMovie("WEB_ADDRESS" + _root.myVars.fileName + [i], "image"+ [i])
it is looking into the ASP file and trying to fine fileName which is the problem. the filename has a number after it, in this case it is the variable [i] but it is returning this


Code:
Error opening URL
'BLAH_BLAH_BLAHfileName=undefined0'
the Blah is the start of the address which you dont need to know about but the undefined with the number after it should be what it is loading. undefined0 should be "fileName0".

is there any way of making it think the _root.myVars.fileName + [i] is all one name?

Thanks

Stupid Saint

Life is only ever what you make of it

View Replies !    View Related
Removing The 11 Sec Infinite Loop Error
I have a very complex script that runs for about 2 minutes (some math simulation). Does anyone know how to remove the pop-up error message that appears by default after 11 secs? I'm talking radical moves here (assembly language and custom hacks). Rewriting the script won't do. I read about a property that can be set for JScript, which is stored in a separate file than the executable and limits the runtime of a script to a preset value. Is Macromedia using something like this? I really need that nag removed.

View Replies !    View Related
[F8] Error Message Created By While Loop
Hi,

When I export my movie from Flash I get an error message that pops up and the movie seems to freeze. The error message says: A script in this movie is causing Flash Player to run slowly. If it continues to run, your computer may become unresponsive. Do you want to abort the script?

This only happens when I try adding a while loop into my script but without one, duplicateMovieClip action keeps on duplicating each time the movie loops. What am I doing wrong?! The code is below. Please help!


PHP Code:



while (i <= 8){
    
    function createMenus(titles)
    {
        for(var i = 0; i < titles.length; i++)
        {
            //copy mold
            var newMenuItem = menuItem.duplicateMovieClip("menuItem" + i, _root.getNextHighestDepth());
            newMenuItem.title = titles[i];    
            newMenuItem._y = menuItem._y + (menuItem._height * i);
        
            
            
            newMenuItem.mySub = i;
        
            newMenuItem.onRollOver = function()
            {
            scale(this, 240); //scale to 200%
            };
        
            newMenuItem.onRollOut = function() {
                if (this != _root.selectedMC) {
                scale(this, 100);
                //scale back to original size
                }
            };
            newMenuItem.onRelease = function() {
                scale(_root.selectedMC, 100);
                _root.selectedMC = this;
                scale(this, 240);
                //scale to 200%
                _root.gotoAndStop(this.title);
        };
        
    }
}
}




Thanks

View Replies !    View Related
Stage.addChild Using For Loop Gives Me Error?
Hi,
I have 4 movieclips on the stage (mc_1,mc_2,mc_3,mc_4) I want to add them as children to the stage using for loop, I have this code:

for (var i=1; i<5; i++) {
stage.addChild(["mc_"+i]);
}

but it gives me this error:
1067: Implicit coercion of a value of type Array to an unrelated type flash.displayisplayObject.

Anybody can help me.

Thanks a lot.

View Replies !    View Related
Error 1046 When Getting BitMaps Via Loop
Hey all,
When I add bitMaps to a class from the library via a loop:


ActionScript Code:
public function unit() {
           
            for (var u:int=1; u<3; u++){
           
                        var getUnit:"c"+[u]=new "c"+[u] (0,0);
// "c1", "c2", "c3" etc. are classes of individual bitmaps in the library

            var putUnit:Bitmap=new Bitmap(getUnit);
           
            addEventListener(MouseEvent.MOUSE_MOVE, doMove);
            addEventListener(MouseEvent.MOUSE_DOWN, startMove);
            addEventListener(MouseEvent.MOUSE_UP, endMove);
           
            putUnit.width=putUnit.width/2;
            putUnit.height=putUnit.height/2;
            putUnit.x=u*10
            putUnit.y=u*10
           
            addChild(putUnit)

            }
           
        }


I get Error 1046: Type was not found or was not a compile-time constant.


I think it has to do with the "c"+[u].
So, what is really causing this, and how can I get around the error -- or rather, How can I dynamically add about 100 bitmaps to a class from the library?'

Thx

View Replies !    View Related
Break A For Loop On Load Error?
I'm having some trouble with the following code- the idea is that it keeps loading jpegs until it runs out of them, ie. a load error occurs. The loading sequence works fine if I manually set a limit on the loop (say 28 for 28 jpegs) but this is part of a website for a photographers' agency website, and each photographer will have a different number of pictures, so I want it to be as dynamic as possible.

So I'm trying to break the loop with a function that is triggered by a load error. The trigger itself works- I put a trace in to test it- the problem seems to be that I can't break the loop from within the function. If I try to set a variable in the function, it returns undefined if I refer to it from outside the function in the for loop...

Any help greatly appreciated!

here is the offending code:


Code:
function loadImages(artist, book, final) {

for (var j=1; j<final; j++) {

thumbNail.duplicateMovieClip("thumbNail_"+j, j);
tMCL.loadClip("../images/"+artist+"/thumbs/"+artist+"_"+book+"_"+j+".jpg", ["thumbNail_"+j].thumbHolder);//duplicates movie clip and loads thumbnail into it

tListener.onLoadError = function() {
trace("bollockit");
} // end function

} // end for

} //end function

View Replies !    View Related
Stage.addChild Using For Loop Gives Me Error?
Hi,
I have 4 movieclips on the stage (mc_1,mc_2,mc_3,mc_4) I want to add them as children to the stage using for loop, I have this code:

for (var i=1; i<5; i++) {
stage.addChild(["mc_"+i]);
}

but it gives me this error:
1067: Implicit coercion of a value of type Array to an unrelated type flash.display:DisplayObject.

Anybody can help me.

Thanks a lot.

but it gives me this error:
1067: Implicit coercion of a value of type Array to an unrelated type flash.display:DisplayObject.

Anybody can help me.

Thanks a lot.

View Replies !    View Related
How Do I Define The Greatest _x Position Based On A Loop, Assuming I Know The Last Element Of The Loop?
Hello,

This may be complicated,

I've a loop that creates emptyMovieClips
then I use one function to onRollOver _xscale them += 10

Now I want to move another movieClip based on the greatest _x position of my previously _xscaled elements, how do I do that?

example

for (var i = 0; i<my_array.length; i++) {
_root.menu_.createEmptyMovieClip("btn"+i, i+1);
}
//
_root.menu_["btn"+i].onRollOver = function() {
this._xscale += 10;
//
MY_DRAGER._x = HIGHT._x;
}

Can this be done?

Thanks,

View Replies !    View Related
Loop Error, Strange. Requires The Help Of An *expert*
the problem is, that right now game_list.length = 2 and so the z variable alternates between 0 and 1. How ever when I press the button, no matter what, z is equal to 2 for some reason, and this happens for both buttons.
here is some out put :

Code:
TRACE z the first time : 1
TRACE z the second time : 1
TRACE z the first time : 0
TRACE z the second time : 0
TRACE z the first time : 1
TRACE z the second time : 1
z : 2
TRACE z the first time : 0
TRACE z the second time : 0
TRACE z the first time : 1
TRACE z the second time : 1

Code:
for (z=0; z<game_list.length; z++) {
trace(" TRACE z the first time : "+z);
this["gamebar"+z].details.onPress = function() {
if (current_viewed != "none") {
image_holder.image_adder["empty"+current_viewed]._visible = false;
}
trace("z : " +z);
image_holder.image_adder["empty"+z]._visible = true;
text_box.detail.text = this["game_num"+z].content;
};
trace(" TRACE z the second time : "+z);
}
im stumped

View Replies !    View Related
I Would Like My Sound Loop To Continously Loop Without Looping Over Itself When I Repeat My Images.
I have a sound loop moving along with my flash images. When the flash images finish and I send it back to frame 1, my sound doubles. How can I play my sound loop once, but allow my images to continously loop.

Is there away to just run one loop of sound, and let the image aspect continue to loop.

I would like my sound loop to continously loop without looping over itself when I repeat my images.

View Replies !    View Related
LoadVars In A For Loop Not Executing .load Function Until For Loop Completed?
Ok so I have a simply for loop: ID[i] is a global array



Code:


for (i=0;i<12;i++)
{
var loadInfo:LoadVars = new LoadVars();
loadInfo.onLoad=function(success:Boolean)
{
if (success)
{
trace("whatever:"+loadInfo.myname);
}
else
{
trace("Nope");
}
loadInfo.load(ID[i]+".txt");
}



the problem I'm having is that the function doesn't execute until the for loop completes and then it executes 12 times in a row. Output is 'whatever: undefined' 11 times and then 'whatever: Bobble' (which corresponeds to the last .myname value as it should). Why is this? And how can I fix it? To be continued...

~NH

View Replies !    View Related
Loop Error In Text Compression (indexing Words)
Im trying to make a script that compresses a certain text, by replacing often used words with an index number. I also want to optimize it by looking at the number of times a certain word is used. The code below is just a starting point, trying to test if a word from the text_array is in the (final) Index Array. If not i should be added, if it is already in there the count should go up with 1. Sounds simple ey? well i managed to screw it up.. I get way to much entries in my Index, so i must be overlooking something.. any help?


Code:
text1="test1 test2 test3 test1 test1 test3 test1 test2";

tempArray=text1.split(" ");

var Index = new Array();
Index = [ ["word",1]]


for (i=0;i<tempArray.length;i++){g=1;
for (j=0;j<Index.length;j++){
if (tempArray[i]!=Index[j][0]) {
Index.push([tempArray[i],[g]]);
}
else{g++;Index[j][1]=g;}

}}
trace(Index.length);

View Replies !    View Related
Loop Inside Loop... Why Doesn't Work Properly?
In order to cause a delay, I have put a loop inside another loop. Here it is:

for (a=1; a<6; a++) {
for (b=1; b<10000; b++) {
}
}

Flash delays to show the page but in the end I just see both variables with the maximun value. The point was to see variable "a" growing with delay. What have I done wrong?

Thank you

View Replies !    View Related
Function Inside For Loop; How To Give It Parameters Of The Loop
Hey!

This is the code:


Code:

for (i=0; i<5; i++) {
_root.createEmptyMovieClip("temp"+i, 1+i);


_root["temp"+i].beginFill(0xFF0000, 20 + (20*i));
_root["temp"+i].moveTo(0+(60*i), 0+(67*i));
_root["temp"+i].lineTo(100+(60*i), 0+(61*i));
_root["temp"+i].lineTo(100+(64*i), 100+(65*i));
_root["temp"+i].lineTo(0+(55*i), 100+(80*i));

_root["temp"+i].endFill();

_root["temp"+i].onRelease = function() {

trace("button Number = " +i);
}
}


So I made butttons and assigned each one an onRelease function. But each one needs to have assigned a variabile by the value "i" in the for loop.
When I write it like this the function itself is defined only after I click it and it ofcourse asigns all the buttons the same "i", the last value of "i" in the for loop.

How do I do it so I get first button with variable 1, second with 2,... ?

Thx.

View Replies !    View Related
Pausing Execution Of Code In A For Loop Between Each Loop. Howto?
I have a for loop which runs x amount of times and between each loop i'd like to implement a small pause of execution of the code. How would i do that? Can something like that only be done using a timer? If so how would i go about doing that and what things should i import? (Trying to do this in a class) ...

View Replies !    View Related
Loop Help: XML Attribute Doesnt Stay On Each Object Of The Loop
Hi, i'm working on a gallery that loads thumbnails from an xml file into 3 columns and when you click on a thumbnail it opens a new window with the fullsized image in.

I have modified code from a gallery tutorial to load the thumbnails from a xml file. They are going in 3 columns at the moment (I don't understand why but they are) but only the last image has a hand cursor when you rollover it, and then when you click on it, it traces "undefined" into the output box.

I have put
Code:
trace(images_arr[i].attributes.fullsize);
just below the bit where it loads the thumbnails and it traces the right path from the xml file for each image.

Can someone help me get it to trace the right path from the xml file when you click on ALL the thumbnails, not just the last one.

Thank you so much in advance!



Code:
function GenerateThumbs() {
images_arr = images_xml.firstChild.childNodes;
gap = 10;
this.createEmptyMovieClip("thumb_mc",100000);
thumb_mc._y = 10;
thumb_mc._x = 10;
for (var i = 0; i<images_arr.length; i++) {
trace('generating thumbs'+i);
this.thumb_mc.createEmptyMovieClip("thumb"+i+"_mc", i);
this.thumb_mc.createEmptyMovieClip("thumb"+i+"_tmp_mc", 300);
this.thumb_mc["thumb"+i+"_mc"]._x = ((i%3)*(67+gap));
this.thumb_mc["thumb"+i+"_mc"]._y = Math.floor(i/3)*(67+gap);
this.thumb_mc["thumb"+i+"_mc"].loadMovie(images_arr[i].attributes.thumb);
this.thumb_mc["thumb"+i+"_tmp_mc"].no = i;
this.thumb_mc["thumb"+i+"_tmp_mc"].onEnterFrame = function() {
var _mc = this._parent["thumb"+this.no+"_mc"];
var l = _mc.getBytesLoaded();
var t = _mc.getBytesTotal();
if ((l>=t) && (t>1) && (_mc._width>1)) {
_mc.onRelease = function() {
trace(images_arr[i].attributes.fullsize);
};
}
};
}
}


var images_xml = new XML();
images_xml.ignoreWhite = true;
images_xml.onLoad = function(success) {
if (success) {
GenerateThumbs();
} else {
trace("Error loading XML file");
}
};
images_xml.load("gallery.xml");

View Replies !    View Related
Pausing Execution Of Code In A For Loop Between Each Loop. Howto?
I have a for loop which runs x amount of times and between each loop i'd like to implement a small pause of execution of the code. How would i do that? Can something like that only be done using a timer? If so how would i go about doing that and what things should i import? (Trying to do this in a class)
Though i'm wondering if there's an easier way than timers to be able to do something like that, like C's sleep() function for example.

View Replies !    View Related
My Sound Loop Is Repeating Itself Ontop Of Previous Loop
Here is a link to a movie that I am working on:


LINK-
http://blue-title.com/v2/


My client says that when you first start the movie, the loop starts fine but when he clicks on one of the three buttons at the bottom (Home, Florida, Alabama) the initial first loop continues to play and a new loop is beginning to repeat while the first one is still playing.

It works fine for me in Firefox and Safari on a Mac.

Any solutions?

Todd Temple

View Replies !    View Related
Movie Clips In For Loop Onlydisplaying In 1st Loop
Hi there! I'm new at this so excuse if I'm being stupid.

I'm creating a game which I'm looping through an array and inside the loop I'm playing clips. The clips display only the first time the loop is being run. Here is the actionscript. PLEASE SOMEONE HELP ME... I'M DESPERATE!!!

code:
on (release) {
var myClips = new Array("Fletter", "Lletter", "Aletter", "Mletter", "Eletter");
var myClipsNewName = new Array("mov2", "mov3", "mov4", "mov5", "mov6");
var myClipsValue = new Array (10, 11, 12, 13, 14);
var cnt = 0;
for (var t = 0; t<4; t++) {
for (var i = 0; i if (cnt == -1) {
cnt = 0;
}
var temp = myClips[cnt];
attachMovie(myClips[cnt],myClipsNewName[cnt], myClipsValue[cnt]);
updateAfterEvent();
trace(myClips[cnt]);
if (i == Total-1) {
myClips.splice(cnt, 1);
myClipsNewName.splice(cnt,1);
myClipsValue.splice(cnt,1);
if (cnt == myClips.length) {
cnt = 0;
}
break;
}
cnt = cnt+1;
if (cnt == myClips.length) {
cnt = 0;
}

}
}
}


edit: jbum added as tags

View Replies !    View Related
Loop Through Loaded Vars To Check If Loaded
Hi

say i have 3 text files that look like:

myarray=blah, blah, blah&finished=1

How can I load the files with a loop then loop through the 'finished' var to check that they are all loaded?

thanks
L

View Replies !    View Related
Mp3 Sound Loop Bad. Wav Loop Good.
I have a soundloop which is a WAV file
and it works just fine when i loop it in flash

But when i convert it to an MP3 file...for osme weird reason theres a little less than 1 second pause when it starts again...you can tell its a loop...not smooth

But in WAV format its fine.
Its weird..ive used two different softwares to convert my wav file.
ive used Creative Wave Studio, Ive used a dedicated third party MP3-WAV convertor.

same results...the mp3 has bad looping.

any ideas?

View Replies !    View Related
[MX04] Loop Loop Whoops
Hi,

I know this might be really simple but I'm having a problem with my movie continuing to loop even though I've put the stop() function anywhere and everywhere I can think of. Basically, I have some mc's in Frame 1 which perform some calculations in AS. At the end of one of the calculations, I have _root.gotoAndStop(2) (which I'm assuming is telling the playhead to move on to the next frame in the main timeline).

I've put in key frames in the second frame for the same mc's to perform some different calculations which are dependent on variables from Frame 1's calculations. After running through the calculations, the movie won't stop looping and I can't figure out why.

Can anyone suggest a course of action? Thanks in advance.

View Replies !    View Related
Stop Loop And Replay Loop
Okay on my stage I have a start(MC) and a stop(MC) and a clear(MC) these will be used as buttons. I also have a dynamic text box that shows my output.

I am making it so when you click start it will start counting from 0 to whenever you hit the stop button, I have changed my fps to 1 so it doesn't crash my computer, And this is where I am running into trouble. Here is my code.

var myTimer = 0;

startBtn.onPress = function() {
this.onEnterFrame = function() {
myTimer = myTimer + 1;
//trace(myTimer);
this._parent.myTxt.text = myTimer;
}

}


stopBtn.onPress = function() {
trace(myTimer);
this.myTimer.onEnterFrame = stop();
}


I would also like it so when you hit start again it picks up where it left off.

Please any help would be greatly appreciated.

Thanks
T

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved