loop () and functions

Hello
I'm having a hard time getting past this little problem. I know its possible, but I hit a mental void.

Here's the scenario:
I have 14 items that I want to spend on the screen with an interpolation function. IM using a loop for () to invite each object, but I'm stuck here. I don't know how to call each object of this loop with a function.

Sketchsta,

> OMG!
> Do you know what the problem was? ... you will laugh!
> I had my randTime Math.round Math.random instead of variable... =)

Heh, I saw that too, but failed to point this out in my follow-up
suggestion). Oy. Glad you taking!

> I thought actually separate topic of X and Y variables.
> I guess that I expected it would generate a new number when
> advertising _x, FLF.

The way in which your original code has been written, it wouldn't. You put
the value of randPos once, then passing that as a parameter (a single
parameter) to another function. As soon as you set the value of randPos, it
only has the value we have. Until you set it again, what is happening on the
next iteration of the loop for () (after the two your _x and FLF properties)
were already interpolated).

> I need the particles from 0 each time. It's just
> for a 'cheap' within a banner, when thrill the Home button
> is clicked.

Cool. Even easier then.

> I used to [strongly type] all the time, but I like that it is
> not necessary?

It is not necessary.

> I have in a long time, and things worked very well.

Luck of the draw!

> What are the benefits of coding in this way?
> In addition to the code hints thing!

In my view, indicators of code is useful and a good enough reason. Another
advantage, in AS2, is improved at compile time error messages. If you type a
variable number (because it is supposed to be a number) but accidentally
Set it to a string (or some other type of data), the compiler is more likely to
do you know that. It is not perfect, but it helps.

In AS3, typing strongly has even more benefits, because it helps to reduce
the overload of the RAM of your SWF file. This is because as the AVM2 (ActionScript Virtual
Machine 2) Flash Player 9 and higher is smart enough to not ask the
memory each strongly typed object needs. Otherwise, as in AS2, each new
object instance needs enough memory to manage everything that type * could * be.

> I have re typed all of the code, at your disposal... sparkF not nesting
> function. I have nested there in the first place, because it would not read the
> rand... variable of the loop for?

It is logical, and here's why. Variables are declared inside the
your function explode(), i.e. that explode() function made their home.
The main scenario does not see these variables and can't nor any other
object outside the service. Scope does not work in this direction: only
from outside to inside. Which means, you can declare a variable in the main timeline
and 'see' inside explode(), but not vice versa. It's
why I added the third variable to sparkF().

> -------------
> change the numbers you use for randomness, in order to allow
> some figures to
> become positive and some negative:
> -------------
> I love it... I don't think that I would have never thought of it.
> knowing me, I probably would have moved the sparks
> 0 x 0 somewhere in the middle and work numbers of
> it. ... pathetic, I know!

No, not pathetic. Do what works, right? This is the way of Flash (and I have
means that with affection for Flash). But it is often easier to change one
some numbers somewhere, having to keep moving symbols of trial and
error.

David Stiller
Co-author, the ActionScript 3.0 quick reference Guide
http://tinyurl.com/2s28a5
"Luck is the residue of good design."

Tags: Adobe Animate

Similar Questions

  • Passing an associated variable number between 'for' loops and functions?

    Hello

    I seem to have a problem with the information how variables can be passed between functions and tables.

    I have variable 'capture' put in place as a number.

    grab var: number;

    My intention (I'll do my best to explain) must have a number 'attached' to catch when it is mentioned for the first time in this function, itemClick.

    These must be all relevant tables:

    clickItemArray = [scene_Camp.wood, scene_Ax.ax]

    itemUsableArray = [wood2, ax2]

    ...

    sceneGuyArray = [scene_Camp.guy_Camp, scene_Ax.guy_Ax]

    function itemClick(event:MouseEvent) {}

    for (grab = 0; enter < clickItemArray.length; grab ++) {}

    If (clickItemArray [type] .hitTestPoint (mouseX, mouseY, true)) {}

    addEventListener (Event.ENTER_FRAME, itemRemoval);

    sceneGuyArray [grab] .gotoAndPlay ("guy_Notice");

    trace ("guy_Notice");

    }

    }

    }

    I would like to have the number in place with grab (it would be a 0 or 1, clickItemArray, sceneGuyArray and itemUsableArray) can be passed on to the next function, itemRemoval. I was hoping to use variables I can use the same function for some point clicked on. For example, if the clickItemArray was point 1 (the axe), then sceneGuyArray [Enter] would be = 1, and would play the right frame. Number 1 would be transferred to the itemRemoval function, where he would constantly be listening to sceneGuyArray [1] also (where '1' would have been obtained through the initial 'grab' in the first function) and react accordingly.

    function itemRemoval(event:Event) {}

    for (var grab2:uint = grab; grab2 < sceneGuyArray.length; grab2 ++) {}

    If (sceneGuyArray [grab2] .currentLabel == 'guy_NoticeDone') {}

    removeEventListener (Event.ENTER_FRAME, itemRemoval);

    trace ("cheese");

    }

    }

    }

    I can't get the track works well. I don't know I'm doing something wrong with 'for' loops or the stated case.

    Naturally, help would be appreciated.

    then, in itemClick(), use:

    Grab = itemClickArray.IndexOf (Event.currentTarget)

  • complete the loop and get data

    I need to acquire the acquisition values of data every x seconds. Waiting in the loop of data acquisition is defined so that the next N samples are acquired after x seconds. Pressing stop the loop of consumer DAQ stops after the sec x which is connected to the wait function.

    1. how to stop the inner loop immediately when you press a stop?

    I also write acquired samples after doing some calculations on the samples.

    1. plan of sample of the queue to file consumer loop. Is there any other recommendations such as drop loop is not without samples? How many data can an expectation of the queue?

    Thank you.

    sonotk,

    You've missed the point. Rather than having a 5000 milliseconds of wait, use an expectation of 100 ms and count the number of times that you have been waiting for 100 ms.  When the count reaches 50, sample and start the count again.

    The counter is just in the shift register containing an integer. Inside the while loop you have a box structure. Test the shift count register to see if it is 50. If set to True, use the real case of the structure of the case. Inside, it's all in your loop except waiting and the logic of the judgment. In the case of false, you add 1 to the shift register and wait 100 ms.

    Looking at your picture code once again, it seems that the shift with TempData and VoltData regsiters are not necessary because you never use the data previous iteration on the left side.

    Ranjeet,

    Make a simple VI with two loops and some expectations.  Run with execution highlighting market to see what is happening.  It is a good learning tool.

    Lynn

  • 2 parallel while loops with functional overall to share data

    Hello

    I'm having a problem with the sharing of functional with globals data between two parallel while loops:

    1. One of the loop (bottom) generates a random number periodically and write the total functional sample.
    2. Another loop (above) has a structure of event and when it expires, he would read the functional global and intrigue, a chart data point.

    The problem is sometimes the functional overall seems to be 'locked' and the output becomes zero constant. It also seems that whenever I first open the VI, it works fine. But for the second time running, he begins to have the problem.

    You must initialize your VI stop FGV FRONT of your lower loop begins.  Even if you use a global variable that is functional, you have a race condition.  FGV is read in the lower loop until it had a chance to be initialized with a value of false in the upper loop.  Functional global variables do not forget their data between executions of the VI.  So it is always set on stop the last time that you ran the VI.  This works your VI the first time it's because VI does not have in memory, so when it loads, it loads with the default value False in the shift register.

  • How to control a VI (with a while loop and a structure of the event) from an another VI

    Hello

    I have the main VI which I want to be driven from an another VI. But I can't do that and I don't know what is happening.

    For example: VI main, I have a while loop with a structure of the event, there is a Boolean controller controlling a Boolean LED, which is inside the structure of the event. And the other VI, there is just a Boolean controller and functions of applications to open the main VI.

    How can I control the Boolean LED in VI main, changing the State of the Boolean controller in an another VI?

    Thank you.

    There are different options, but depending on what you want to do. For this example I can't give you a specific solution.

    I do not understand why you do what you do. Why do you call your 'principle VI' dynamically? What is the advantage to do? There are also other ways to call a VI dynamically, based on real cases (for example the method "call and forget", etc...).

    In you principle VI, control you Boolean ("THATCHER") is not the case of corresponding event. This is not usually a good practice, keep it inside.

    Also, why you try to communicate with the caller and callee VI through such a way to twist? There are better ways to do it.

    In one of my projects, I use the user event to launch orders in case of case of appellant VI.

    some Associates more readings for you:

    http://www.notatamelion.com/2015/03/23/how-to-make-dynamic-subvis/

    http://forums.NI.com/T5/LabVIEW/Dr-Damien-s-development-event-structures-III-communicating-with/m-p/...

  • How to load 2 xml galleries loop only function.

    How to load 2 xml galleries loop only function.

    my function is-

    var myGalleryXML = new XML();

    myGalleryXML.ignoreWhite = true;

    myGalleryXML.load ("gallery.xml");

    function callThumbs()

    {

    _root.createEmptyMovieClip ("Wall", _root.getNextHighestDepth ());

    Wall._x = _root.gallery_x;

    Wall._y = _root.gallery_y;

    wall.addEventListener (MouseEvent.CLICK);

    var clipLoader = new MovieClipLoader();

    preloader var = new Object();

    clipLoader.addListener (preloader);

    for (i = 0; i < 6; i ++)

    {

    thumbURL = myImages [i].attributes.thumb_url;

    myThumb_mc = wall.createEmptyMovieClip (i, wall.getNextHighestDepth ());

    myThumb_mc._x = _root.thumb_height * i;

    myThumb_mc._x = _root.thumb_position = - 3100 + (i - j) * 765;

    clipLoader.loadClip ("store /" + thumbURL, myThumb_mc);  I want to load this XML Gallery "gallery1.xml".

    preloader.onLoadStart = function (target)

    {

    target.createTextField ("my_txt", target.getNextHighestDepth (), 0,0,10, 10);

    Target.my_txt. Selectable = false;

    };

    preloader.onLoadProgress = function (target, loadedBytes, totalBytes)

    {

    Target.my_txt. Text = Math.floor ((loadedBytes / totalBytes) * 100);

    };

    preloader.onLoadComplete = function (target)

    {

    The new Tween (target, "_alpha", Strong.easeOut, 0, 100,.5, true);

    Target.my_txt.removeTextField ();

    target.onRelease = function()

    {

    callFullImage (this._name);

    };

    target.onRollOver = function()

    {

    This ._alpha = 100;

    };

    target.onRollOut = function()

    {

    This ._alpha = 100;

    };

    };

    }

    for (i = 0; i < 6; i ++)

    {

    thumbURL = myImages [i].attributes.thumb_url;

    myThumb_mc = wall.createEmptyMovieClip (i, wall.getNextHighestDepth ());

    myThumb_mc._x = _root.thumb_height * i;

    myThumb_mc._x = _root.thumb_position =-7210 + (i - j) * 765;

    myThumb_mc._y = _root.thumb_position = 180;

    clipLoader.loadClip ("banner /"+ thumbURL, myThumb_mc ");  / / I want to load this XML Gallery 'gallery2.xml'

    preloader.onLoadStart = function (target)

    {

    target.createTextField ("my_txt", target.getNextHighestDepth (), 0,0,10, 10);

    Target.my_txt. Selectable = false;

    };

    preloader.onLoadProgress = function (target, loadedBytes, totalBytes)

    {

    Target.my_txt. Text = Math.floor ((loadedBytes / totalBytes) * 100);

    };

    preloader.onLoadComplete = function (target)

    {

    The new Tween (target, "_alpha", Strong.easeOut, 0, 100,.5, true);

    Target.my_txt.removeTextField ();

    target.onRelease = function()

    {

    callFullImage (this._name);

    };

    target.onRollOver = function()

    {

    This ._alpha = 100;

    };

    target.onRollOut = function()

    {

    This ._alpha = 100;

    };

    };

    }

    }

    combine the two into a single xml files if you want to create a gallery.

    If you want two different galleries that display at different times, tear down the wall of movieclip after that finished with gallery1 and run myGalleryXML.load("gallery2.xml");

  • Pad touch and function Fn + F5 does not work on the Satellite a series

    Hello

    I just install a windows Vista & I have install the driver after download it from the net, but I found this;

    1 - switch between the screen & s-video (fn + f5) does not work but the other work of function (fn)

    2 when I put my finger in the right of the mouse pad you have to scroll the screen & at the bottom of the touchpad, it should scroll left & right on-screen, but it did not work

    So please tell me the solution if it is a problem of driver or program.
    Please give me the direct link

    thinku

    Hello

    What cell phone do you have?

    I imagine that your laptop comes with XP and now want to use it with Vista OS.
    Please note that you should install the Package Toshiba Vista value added to use all the features of the laptop.
    Very important is the pilot of common components and the TOSHIBA Flash Cards.
    The Flashcards provides the Hotkey function and function of pitcher who starts the Hotkey function.
    Please reinstall!

    The additional touchpad functionality must be configured first.
    This can be done in the control panel-> mouse

    Here, you should look for the touchpad settings and able to configure touchpad again scroll areas.

    Good bye

  • Apple Loops and tempo (distortion)

    Hi, I am really desperate to try to find a solution to this problem. But it seems that no one knows the same thing.

    I just purchased Logic Pro X. Im using a macbook mid-2014 race 13-inch pro retina El Capitan 10.11

    The problem is really weird. When using some Apple Loops loops and change the tempo of my project I get these really annoying audio distortions on the loops.

    I do a lot of original audio loops tempo change. The best example I can get is changing 128bpm (which is the tempo of the loop) at 130. Or 125 to 130. And I get this kind of flanger/distortion. Don't know how to describe it exactly.

    Some loops that I use are:

    -Jazz trance Beat 02

    -Garage atomic Beat 01

    Someone knows a solution? Or anyone having the same problem?

    Thank you very much!

    You have successfully updated to 10.2.1 LPX?

    I tested these two loops by dragging them into a new project, speeding up the tempo up to more than 150 and back again... and heard nothing unusual...

    There is always a small amount of audio artifacts as you are speeding an audio file (the process requires some audio data jump/compression...) and not a MIDI... but again, nothing, I would say, approached distortion...

  • Dividing the curves with loops and berries

    Greetings,

    I like a wave form and I need to divide the curve so that it consists of three segments, each segment starting at the value of a peak and ending to the next using loops and berries.  I also need to combine in a 2D array and draw the waveforms.

    I'm stuck on how to do it. I have attached my code.

    Can someone give me some ideas?

    Thank you!

    TheLT

    I'm picturing something along these lines.

  • Paralel loops and communication series

    Hello

    My current LabView project, I use the 'messages in queue manager' design patern. The program has Labview recover data from several devices connected to serial ports. For devices where I am for the most part, the convernd of their status in this way works as expected and good. The data in the response is passed to the rest of my program using notifications.

    However, I also have a testrack to where I need to send multiple commands (from different loops) and (in most cases) need answers from the testrack in the loop that passes the initial question.

    So now my question is: How can I check the answer in the loop of transmission being the other line 'not affected' (it's ok for me if they see the answer as long as the original transmission loop always get data). (L'espoir) to make it more clear, I have also attached a picture of the wat I would like to have)

    I hope you can help me.

    For each (serial, asynchronous,...) device write a State of the queue controlled MC who manage the device.

    The control file handle init, installation, recover data, get statusXY,..., free_device and outputs are named the queues for the stream (standard) and additional information (status).

    The data queue command group contains not only the order more parameters but also the name of the output of this command queue.

    Like this, the State of the MC device control each request for data (and may for example cancel or update a selfcal ask for a measurement...)

    (a good practice would be that data are only send existing, named queues )

  • A problem with delays in call loops and DAQ

    I'm programming a simulation for nuclear Rewetting for a reception centre to my company in Switzerland. It is a "fuel rods" heating and then fill the water Chamber. The pump starts automatically as soon as the core of the stem reached 750 C. After that, a requirement that the flow rate be checked to ensure the operation of the pump in the necessary conditions. If not, the heating must be stopped to avoid, well... meltdown. However, we must allow 10 seconds for the pump to respond, while allowing a rate of acquisition of data from 10 to 100 Hz.

    The challenge is that I can not add a delay in my other main loop delay all acquisitions, but I can't understand how to trigger a device loop (with data acquisition for the single channel flow control) and the main loop when the loop device determines if the flow a initalised, answering the main loop with the agreement.

    I think that a large part of my confusion is in the interaction between loops and knots of default comments labview's willy nilly. The only solution would be to have two 'core' loops that do not communicate with them, but rather to do the same thing while operating different synchronization? Tell me if you want I will post the file (even if its on a unnetworked computer and I don't think that it would also be useful).

    Thank you + Curran

    Here is a version 9.0.

  • I get an error on blue screen ATI2DVAG infinite loop and am looking for a suggested solution for XP.

    get an error on blue screen ATI2DVAG infinite loop and I am looking for a suggested solution for XP.

    Hello jvecc,.

    Thank you for visiting the Microsoft answers community.

    This problem is caused by a defective unit or a device driver. Visit the website of the manufacturer of your computer or see if AMd drivers directly will work for your hardware configuration and then uninstall and reinstall your drivers.

    Hope this helps Chris.H
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • can not get the printer to work when sending my laptop computer that he used to work the printer is on and functional

    Can't get printer to work when sending my laptop computer that he used to work the printer is on and functional. Canon pixma MP180

    Hi NickManchisi

     

    1. for how long have you been faced with this problem?
    2. what happens when you try to print?
    3. do you receive any error messages?

    Method 1 :
    Please refer to the below mentioned article and check if the given steps help.

    http://support.Microsoft.com/kb/308028


    Method 2:

    You can even perform a restore of the system to a previous point, when the issue was not present. The System Restore tool uses points of restore to return the system files and settings to an earlier point in time. You can use it to restore the operating system to a point in time when you have not experienced the problem.

     

    Note: When you use System restore to restore the computer to a previous state, programs and updates that you have installed are removed.

    To do this, there must be a restore point from the system in which the connection was successful.

    Refer to the following help link on performing a system restore.
    http://support.Microsoft.com/kb/306084

     

    I hope this helps.

  • Windows XP media center keeps going in a loop and will not complete the boot.

    Rebooted PC, probably because of an update, but I also dropped the mouse wireless in the word, and I don't know if that's the problem.  To start Windows and I have three choices, but if I choose safe, last known config, or normal mode, it ends the countdown and starts, but loops to the same black screen that has the countdown.  Help!   Thank you very much.


    Remember - this is a public forum so never post private information such as numbers of mail or telephone!

    Ideas:

    • You have problems with programs
    • Error messages
    • Recent changes to your computer
    • What you have already tried to solve the problem

    the problem is known as "boot loop" and it is generally caused by a lack of disk and file system tune up

    There are commands that can be executed in the disk prompt that will help stabilize the boot process.

    However, you need to start with any xp cd and launch the recovery console to log on to the disk system.

    then the disc prompt, run the following commands >:

    Chkdsk

    Fixboot

    FIXMBR

    (the fixmbr will provide a serious warning, but you can ignore the scarecrow)

    then the output, remove cd and the system should be able to boot normally again.

    DB·´¯'·.. ¸ >-))) º > ·´¯'·.. ¸ >-))) º > share nirvana mann

  • When I check the updates, it goes into endless loop and never off.

    Original title: windows updates

    When I check the updates, it goes into endless loop and never off. Even if there is no new update, he said usaly. What is gpoing?

    Please run the Windows Update Troubleshooter:
    http://go.Microsoft.com/?linkid=9830262

    Please provide details of any problem it reports as not fixed.

Maybe you are looking for

  • prevent the opening of hidden Firefox tab groups

    I love firefox and tab groups. I have a lot of tabs open across the broad range of groups of tabs. Firefox uses huge amounts of RAM because of the workload of each tab, in each group independently of cases I see in the session or not. It would be nic

  • The hard drive capacity

  • Where are the videos recently added (new Apple TV, 64 GB)

    I mainly use my Apple TV to the floor to show my videos from my media server.  I add about 3 videos per week that I use to show my students.  On the old Apple TV, if you browse the 'computer', when you back out to the main screen, you can see recentl

  • Information on my monitor is coming from vertical instead of horizontal?

    My son was playing with my computer. And some how it got on my computer to go vertical. (Photos, everytime I open a new window, I have to turn your head to the left to read everything.) My monitor I have is a big screen... Imagine if I had the widesc

  • Problem with on Inspiron 1521 1390 mini card

    For the past few weeks, I had trouble maintaining a stable wireless internet connection.  I have intermittently lose connection or the connection strength fluctuates.  I have an Inspiron 1521, with a Dell Wireless 1390 Wlan Mini Card.  Also, I am run