Repeat functions, will not change variable. Confused Reeeallly

OK... So yes, I'm rehearsing a function that will essentially attachmovie on a 'field', an image based on the parameter.

It's called AddID (i), and currently there are only 2 valid options, 0 and 1, showing the images, X and O.

There is a button and theres a table and a function that shows a picture of the tile based on its ID value loaded from the table.

My problem is:

Everything works just great as if you repeat the function by clicking again, but...

When we repeat the code function, all the tiles will be the Image of the last tile added.

It's my script actionscript code.

IDonTile = new Array();

IDonTile = [0,0,1,0,0,1];

_Global. Tile = 0;

And that's my buttoncode.

{We (Release)}
AddID (IDonTile [_global. Tile]);                 This function adds the tile on my screen
TileList.Text += TileSlot [_global. Tile];         It's actually a textfield debug to see what value is supposed to be responsible

_Global. Tile += 1;                                    Therefore, the next time that the slab is added, the following value will be used as an identifier.

}

It works very well!

If I click on this button 6 times, I'll have in the following order: X, X, O, X, X, O

The debugging text field displays: 0,0,1,0,0,1

BUT

I want to add all 6 tiles instantly, I would just use the function in a loop for, or repeat 6 times, the code like this:

{We (Release)}

for (i = 0; i < 5; i ++) {}
AddID (IDonTile [_global. Tile]);                 This function adds the tile on my screen
TileList.Text += TileSlot [_global. Tile];         It's actually a textfield debug to see what value is supposed to be responsible

_Global. Tile += 1;                                    Therefore, the next time that the slab is added, the following value will be used as an identifier.

}

}

Text field to debug the poster: 0,0,1,0,0,1

Which is in fact correct

BUT ALL 6 TILES WILL BE: O, O, O, O, O, O

It is 6 O

AddID (i) function is only 10 lines long.

I don't want to manually add my 6 windows, what should I do if I had 100 tiles

I was wondering, is there something wrong on Actionscript 2?

Should I switch to Actionscript 3 maybe this will work?

Because if I can manually click on the button, and it works, it must be exactly the same if I have the Correct code by a loop of foor?

I'm reaaaallly confuseddd T, T he shouldn't BAA like this

Help, please!

I thanks in advance for any response...

Cause the last time I tried to ask for help, I had no...

Here's a solution... If I have the function of rewriting and eliminate the use of the binding of the tile, it works.

function AddID (iID) {}
If (tiles<>
{Switch (IID)}
case 0:
attachMovie ("X", "Tile", tilelayer, {+(iconwidth*tX), _y:ky+(iconheight*tY)}) _x:kx;})
break;
case 1:
attachMovie ("O", "Tile", tilelayer, {+(iconwidth*tX), _y:ky+(iconheight*tY)}) _x:kx;})
break;
}
addTile();
}
{if(Tiles==tilesets)}
MsgBox.text = "You have nowhere to store. »
}
}

If for some reason that is not desirable, then here's an alternative.  I think I've narrowed the problem to be one of the timing... something in the loop cannot react quickly enough to changing _global. Value of the tile and I suspect it's the attachMovie activity.  This solution involves slowing the speed at which the file is trying to reach movies...  The button that launches adding tiles place the following...

{We (Release)}
myInterval = setInterval (fillTiles, 10);
}

And in the code of the timeline, add the following...

var myInterval;

function fillTiles() {}
If (_Global. Tile<>
AddID (IDonTile [_global. Tile]);
TileList.Text += IDonTile [_global. Tile]
_Global. Tile += 1;
} else {}
clearInterval (myInterval);
}
}

Tags: Adobe Animate

Similar Questions

  • Will not change variable

    I'm trying to make a clone of the game remoddled to http://62.212.67.28/games2/game/7548.swf

    so far, I have a few drops that move slowly downwards through a door, then when they are off the screen, they jump above the screen to come back down.

    My problem is that the door is controlled by using this code on a butten the user:

    on (release) {}
    If {(door1.state = true)
    door1.closeit ();
    } else {}
    door1. OPENIT();
    }
    }

    This code works perfictly but blobs are ment to stop when the door closes, they use this code:

    onClipEvent (enterFrame) {}
    If {(door1.state = true)
    _y++;
    } else {}

    }
    If {(FLF > 400)
    FLF = - 5
    }
    }

    If necessary the code for the door is when it is opened:

    State = true;
    Stop();
    closeit = function () {}
    Play();
    };

    and closing:

    State = false;
    Stop();
    OPENIT = function () {}
    Play();
    };

    and the last picture when the door is closed again:

    gotoAndStop (1);

    BTW when I tried to attach the file it gave me the error that the content of this attachment type is not allowed.

    Thanks for the help,

    screenaddict

    your if statements can use the double equal (==).

  • HP 15-r018dx Notebook PC brightness will not change

    Will not change the brightness on my HP 15-r018dx Notebook PC, without using the function keys or cursor in "Power Options." This started happening the day before yesterday; before that, I had no problem. I don't know what changed between yesterday and today.

    Could someone help me?

    Hi wkeyiosksol,

    Try using the Recovery Manager HP to restore the original drivers. Search for your graphics drivers and install them. Should be included as a high-definition or high-definition of NVIDIA Graphics Driver Intel graphics driver.

  • Canvas work will not change to white in design mode.

    Canvas work will not change to white in design mode.MUSE CANVAS.JPG

    Inadvertently, you have activated the superposition of the grid. Disabling this function using the menu "show/hide grid Overlay" or by pressing ALT + CMD + SHIFT +'

  • My your whatsapp will not change after update

    I'm back changing my tone whatsapp after the update, but it will not change back

    Greetings, cazrose. Thank you for the communities of Apple Support!

    I see that WhatsApp is not allowing you to change his ring back to what it was after upgrade your iPhone to iOS 10 6s. I'll be happy to help you!

    How can I change my ringtone for WhatsApp? -Follow the instructions of the support that I have found on the site of WhatsApp.

    Have a great day!

  • How can I change my country when I have a balance that I can't buy anything with? It will not change me cause I have a balance of 0.07 pence

    How can I change my country when I have a balance that I can't buy anything with? It will not change me cause I have a balance of 0.07 pence

    Click here and ask the staff of the iTunes Store to zero the balance of your account.


    (142584)

  • Portege M700 will not change the screen orientation

    I installed the driver for the webcam for the M700, and every time I install it, I get the same error message:

    "Open Webcam driver fail - please restart camera or computer."

    I reinstalled the drivers of many times, and it still does not work.

    Therefore, I tried the msconfig method, disabled all the startup process and then reactivated their.

    The webcam shows the same error message, and now the screen will not change orientation when I rotate the screen.

    You try to use Windows XP Home edition or what? Generally, each laptop comes with preinstalled and configured operating system.

  • Keyboard and spell check language will not change back to English after a stint at the French although everything changes again in English

    I changed language iPad in French (but not the region, which remains United Kingdom) in order to write an email in French.  Everything on the iPad changed in French as expected.  When I'm done I changed the language to English (UK) and everything changed in English unless the auditor keyboard and which remained in French.  I then changed to English (India) but the keyboard and spell checker is in French.  I have changed the language to the French and finally back to English (United Kingdom).  While everything on the iPad to the language changes expected, the keyboard and spell checker will not change to French.  How do go back to English?

    Press the 'globe' and select English.  It is the keyboard that determines the spell checker (not the language or region).

  • Apple's music will not change the song on shuffle mode

    My iphone6 will not change the songs Apple music in shuffle mode. Once selected the song again and again.

    Hello

    update your iphone to ios9.2

    Settings > general > software update

  • Mini 210-1080NR: down loaded Windows 10. view now showing BACK script and will not change. Mini 210-1080NR

    Try load W-10. Process appear to be normal. The display is now BACK showing script and will not change and cannot close the laptop down or off. Not a user made and do not want to complicate the issue.

    WAWood;

    The laptop has completed W - 10 download and installation seems to work as announced.

    The problem with the 1st attempt will be captured in Gremlins.

    Thank you for your quick response.

    Ben

  • EA4500 will not change to the new public IP address

    I noticed that, after the new Firmware update, the EA4500 will not change to a new public address.  I check my logs and my IP address is the same that goes back to a 25/03/2012.  I changed my router to my old E4200V1 and it turns into a new address when the old one expires.   I tried several resets hard but in vain.

    Ask your ISP. The decision taken by the DHCP server from your ISP, what IP address it assigns. You must accept what they give.

  • HP Pavilion 15z Touch: screen brightness will not change

    When I use the keyboard commands to adjust the brightness of the screen, it does not work. When I go into the control panel to set the brightness of the screen remains the same. The adjustment bar will move from dim to bright but the brightness of the display will not change. How can I fix it? I've only had this computer for 4 days, so everything is still at the factory.

    Hello @KayLeeM,

    Welcome to the Forums of HP Support! It's a good place to find the help you need, so many other users, the HP experts and other members of the support staff.

    I came across your post about the brightness of the display and wanted to help!

    Try searching for the Device Manager in the Start Menu.  Then expand the monitors section and see if you have an option for Generic PnP monitor.  If so, do a right-click on him and generic PnP monitor enable, if not already.  Now, check to see if you can adjust the brightness.  If you're still having problems, then try to see the following resource and let me know how it goes:

    Difficulty of Windows 10 brightness control works not problem, here's how to [Guide]

    (Not a HP website supported).

    Please let me know if this information has been helpful by clicking the thumbs up below.

    Kind regards!

  • Envy 14 DVD will not change the region Code

    My Envy 14 is until the last amendment of the Code of the region, he told me that he can change the region Code 1 more time but it WILL NOT change the region code.

    I try to change in the properties of the device of the "DVD RAM UJ897', he said 'this is your last chance to change your DVD drive region setting. Are you absolutely sure you want to continue? »... I click OK, it asks me to insert the support in this area (it is already in the tray)... I re - insert the Code region 2 DVD, and I get the error "failed to update the region Code setting. Please make sure the drive contains a region 2 media (it does) and you have administrator privileges (me) «...»

    The HP MediaSmart SW also tells me "Drive region code: region 1.» Number of times where you can change the region code: 1 ",... .He told me that the inserted DVD 2 Code region and asks if I want to change... I say yes, then confirm and nothing happens. I can't read the 2 region code DVD...

    Hello

    Start in safe mode by pressing f8 when you start your PC.  Use the arrow keys to select Safe mode and press return.  Once charged, try to change the area by car.  If it still does not work, try the procedure but with another another DVD zone 2 under Windows can be picky about what it accepts.  If it works, just restart your PC and Windows does not start normally.

    Best wishes

    DP - K

  • Windows will start, the screen starts flashing and then the screen say Logging Off, then restore the screen to the CTRL ALT DEL all other functions will not work.

    Start my computer, it will default to the CTRL ALT DEL screen.  After graduating in the login screen I enter the password.  Windows will start and then the screen starts flashing and the screen say Logging Off, then restore the screen to the CTRL ALT DEL I can boot into safe mode.  All other functions will not work.

    Thank you

    I guess you wanted to ask how to solve the problem. If then all in Safe Mode you can use system restore to set up Windows to a point when the problem did not exist.

  • My professional background of Windows 7 will not change.

    I have a Windows 7 Professional 32-bit computer, and will not change the background.  It is stuck on one front image, no matter what I did.  Now it is stuck on one color, I can change the color, but not to any real image.  I have a theme that has a slide show, but when I chose the theme, he said that my background is the photos for the slideshow, but when I look at its still a solid color.  If I right click on it does not give me the next opportunity to "change background".  There is an unsaved theme assigned a background in one color, but its not selected, and even if I select it and change the background it goes backward.  I can't even change the background, when I right click on an image and click on set as background.  If I save the theme, he recorded with the bottom, I wanted, and then creates a new theme unregistered with the solid as the background color and uses.  Any help would be appreciated.

    Hi, I found new information that might be useful.  It's in another thread, but I can't immediately find, but here is the important part:

    1 - Go to this folder: %USERPROFILE%\AppData\Roaming\Microsoft\Windows\Themes\
    (copy and paste that in the start/search or Run box).

    2 - remove the TranscodedWallpaper.jpg file.

    3 try to set your wallpaper again.

    Sorry I can't find the link, but it was a confirmed a team of Microsoft TechNet blog.  I hope this helps!

    If it solves your problem, click on the link "Propose as answer" below and vote as useful by clicking on the green triangle for the lelft. Thank you!

Maybe you are looking for