What am I doing wrong with this loop?

It drives me crazy! I am trying to create 100 triangles, like a little challenge for me, in random positions.

import flash.display.MovieClip;

addEventListener (MouseEvent.CLICK, 100Tri)

function 100Tri() {}

for (var i: int = 0; i > 100; i ++ ;)) {}

var positonX:int = Math.random () * 550;

var positonY:int = Math.random () * 400;

var triangle: MovieClip = new Triangles();

triangle.x = positionX;

triangle.y = PositionY;

addChild (triangle)

}

But he returned as a constantly

Scene 1, Layer 'AS', frame 1, line 21084: syntax error: expected rightparen before sorting.
Scene 1, Layer 'AS', frame 1, line 31084: syntax error: expecting identifier before 100.

There is a class named 'Triangles', which is related to a movieclip of a triangle. It contains nothing, but what is in all classes.

Help? I'm sure it's just a little thing miss me, but its annoying me. >. <

Hello

There are a few stupid errors in your code. Use it below:

import flash.display.MovieClip;

stage.addEventListener (MouseEvent.CLICK, triangles)

function triangles(e:MouseEvent)

{

trace ("click handler")

for (var i: int = 0; i > 100; i ++)

{

var positonX:int = Math.random () * 550;

var positonY:int = Math.random () * 400;

var triangle: MovieClip = new tri();

triangle.x = positonX;

triangle.y = positonY;

addChild (triangle)

}

}

Kind regards

Vipul

Tags: Adobe Animate

Similar Questions

  • What am I doing wrong with this idea of menu?

    Hi team,

    I am trying to build a menu but have two problems, as you can see on the vid when I press one of my button fly, closing at all (which could be authorized)

    Quen worst is that even if I have the names of instance for all the steps and the target tool allows you to find the path to these buttons, I can't access it from the main timeline.

    Here's the code...

    import flash.events.MouseEvent;

    import flash.display.MovieClip;

    GSmain.gsshape.gss1.gssr1.addEventListener (MouseEvent.CLICK, page2go);

    function page2go(e:MouseEvent) {}

    gotoAndStop (2);

    }

    and the error...

    TypeError: Error #1009: cannot access a property or method of a null object reference.

    to aavar / frame1 () [aavar::frame1:4]

    aavar is the document class associated with this file

    If

    GSmain.gsshape.gss1.gssr1.addEventListener (MouseEvent.CLICK, page2go);

    is frame 1/4, GSmain.gsshape.gss1.gssr1 does not exist when this code runs.

    you have also nested named functions which is always problematic:

    function whatever() {}

    function whatevernested() {}

    }

    }

    should be

    function whatever() {}

    }

    function nolongernested() {}

    }

  • What I am doing wrong in this loop?

    How I can change this code
    to get the result like this

    If the user, enter the number of hours travelled = 3
    and please enter the speed of the vehicle in miles per hour = 40
    the method computes 1 * 40
    2 * 40
    3 * 40
    I need to use the loop
    Thank you, I am just learning JAVA

    I need the output to look like this

    /*
    * Description Convert distance settings: Int: speed, number
    * hours traveled (milePerhour, numberOfhoursTraveled, distance)
    * Performance: integer: Distance
    */
    public static double convertDistanceTraveled (int milePerhour, int numberOfhoursTraveled) {}
    return (milePerhour * numberOfhoursTraveled);

    public static double convertDistanceTraveled (int c) {}
    int dist = milePerhour * c;
    return dist;
    }
    }
    Edited by: 893973 on Oct 18, 2012 1:37 PM
    
    Edited by: 893973 on Oct 21, 2012 4:24 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

    Hello

    Try changing your loop as follows:

    for (int i = 1; i)<=numberOfhoursTraveled;>
    {
    System.out.format ("%s\t\t%s\n", I, convertDistanceTraveled (milePerHour, i));
    }

    Also change the return type for the function convertDistanceTraveled of the House double int.

    Hope this helps,

    Thomas

  • What am I doing wrong with this simple table?

    I have a table that I need to add unique characters to slowly.

    If the table is wordToCheck and I have a few "drop places" to check and see if a letter "fell off the coast." An index is assigned to each point of fall and I just want to add the letter to the appropriate index of the table so that I can push in a string.

    This is my code:

    wordToCheck [currentBlank.register] = currentLetter.letter.toLowerCase ();

    So you can see that if 'A' has been abandoned to the empty spot with the 2 register it would return "-a".


    The problem is that it is remove each time that I add a letter. If I put 'A' in the registry and then 2 "M" save 3 it returns '-m '.

    How do it do not replace itself every time?

    1. to the original post: If you use the same instance of table - it shouldn't happen. Looks like whenever you add letter - it's a new instance of the wordToCheck table.

    2. If you want to convert the string table - use Array.join () method.

  • What I am doing wrong in this little pl/sql statement?

    Hi all

    I'm happy to write in this forum for the first time. Can someone help me show what I'm doing wrong in this little summary:

    create or replace procedure augmente_salaire (employees.employee_id%type IN p1, p2 IN number (3))

    is

    Update employees set salary = salary + salary * p2/100 where employee_id = p1;

    end augmente_salaire;

    Start

    augmente_salaire (1001,20);

    end;

    I use pl/sql developer.

    Any help would be appreciated.

    Best regards.

    Hello

    Welcome to the forum.

    You missed a BEGIN block after the IS. Between IS and BEGIN, you declare your variables.

    And the parameter should be the NUMBER instead of number (3).

    Do you get an error message when you tried to run your code?

    Concerning

    Marcus

    Post edited by: Marwim

  • HWAT am I doing wrong with this webcam?

    Hello!

    I found a tutorial in a .pdf file on webcams, usb and how to make them work with labview... so... I managed to make this diagram below!

    But it still does not... What am I doing wrong? Or... you have a better scheme for this application? Or a diagram simple JAWS!

    Help! : s


  • What am I doing wrong with the visibility _ property?

    I have an object that is a clip, and I want this object to disappear when you click on him, but also the button that makes the object appears to be also subject to disappear. Anyway, when you click on the object or on the button for the second time, the same object to disappear.  I managed to do it, but the first time when you click the button to display the object it doesn't work, you have to click twice. What I am doing wrong? The object, it's a clip named frez1, and the button is named fr1. I put this code in the main scenario: for the clip: frez1.onPress = function() {_root.frez1.gotoAndStop (2);}                                      _root.frez1.gotoAndStop (1);                                           } button: frez1._visible = false;                                     FR1.onRelease = function() {frez1._visible =! frez1._visible;}                              } Button and the object are on different layers.  Thank you for your help.

    The first thing you can do is avoid the unnecessary use of _root references.  If the code is in the scenario where the object exists, there is not need to refer to the timeline (i.e. in this case the _root).

    Saying the movieclip to go to box 2 immediately followed up by saying to go to frame 1 will always be in frame 1.

    If you want to be able to click the movieclip to make it visible, then you can make invisible because the invisible objects do not interact with a mouse.  You will have to modify its _alpha rather property.  Try to replace all the code show you by what follows and to eliminate the appearance frames of frez1...

    frez1._alpha = 0;

    function toggleMC() {}

    If (frez1._alpha == 0) {}

    frez1._alpha = 100;

    } else {}

    frez1._alpha = 0;

    }

    }

    frez1.onRelease = fr1.onRelease = toggleMC;

  • Can someone tell me what I'm doing wrong with C5180

    Thank you for reading my post. I have a Photosmart C5180 all-in-one printer. I do calendars for my children. I have a PC with Windows Vista. I've been printing these for two years using the HP Photosmart Essential software. I am trying to print a picture of 'full page' on 8.5 "x 11" photo paper. I get a message saying that the image size is too large for the paper. I'm going goofy trying to get this image full-size to print. I have done many times before and can't happen now. Any suggestions?

    Thank you very much

    Smurfsdad

    Thanks Matmaria for your suggestion. This does not, as did nothing else I could think of. I think that sort of 'Vista' was behind all this. I was pulling my hair out. Finally, I downloaded an updated version of the Photosmart Essentials and it allows me to do what I was trying to do. Thank you again... Smurfsdad

  • that is wrong with this loop

    1 Declare
    2 v_system_user VARCHAR2 (30);
    3 v_system_user_flag number: = 0;
    4 v_username varchar2 (30);
    5 cursor C_system_users is select * from dbaoper.t_system_users;
    6 start
    7 for v_system_user in C_system_users loop
    8 dbms_output.put_line('v_system_user');
    9 if v_username = v_system_user
    10. can
    11 v_system_user_flag: = 1;
    12 end if;
    13 end of loop;
    14 * end;
    SQL > /.
    If v_username = v_system_user
    *
    ERROR on line 9:
    ORA-06550: line 9, column 16:
    PLS-00306: wrong number or types of arguments in the call to '='
    ORA-06550: line 9, column 2:
    PL/SQL: Statement ignored


    Thank you
    Pramod

    You declare a variable of v_system_user second here:

    Pramod Garre wrote:
    7 for v_system_user in C_system_users loop

    Probably, you would do this:

    for r in C_system_users loop
    ...
    if r. = ....
    ...
    

    Published by: Toon Koppelaars July 8, 2009 17:20

  • What is wrong with this sequence, it does not work when, after 3 inserts, I add a new record with the trigger it gives an error.

    Mr President.

    What is wrong with this sequence, it does not work when, after 3 inserts, I add a new record with the trigger it gives an error.

    --SL_CUSTOMERS table data
    
    
    INSERT INTO SL_CUSTOMERS VALUES(1,'Kamrul Hasan',NULL,NULL,'Moghbazar', 'Dhaka','0456789123',NULL,NULL,NULL,'Y',NULL);
    INSERT INTO SL_CUSTOMERS VALUES(2,'Rabiul Alam',NULL,NULL,'Motijheel', 'Dhaka','0567891234',NULL,NULL,NULL,'Y',NULL);
    INSERT INTO SL_CUSTOMERS VALUES(3,'Shahed Hasan',NULL,NULL,'2-G/1,2-2,Mirpur', 'Dhaka','0678912345',NULL,NULL,NULL,'Y',NULL);
    
    
    
    

    CREATE SEQUENCE  "ALIZA"."SL_CUSTOMERS_SEQ"  MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 NOCACHE NOORDER  NOCYCLE ;
    
    
    CREATE OR REPLACE TRIGGER SL_CUSTOMERS_TRG 
    BEFORE INSERT ON "ALIZA"."SL_CUSTOMERS"   
    FOR EACH ROW   
    BEGIN   
    IF :NEW.CUSTOMER_ID IS NULL OR :NEW.CUSTOMER_ID < 0 THEN  
      SELECT SL_CUSTOMERS_SEQ.nextval   
        INTO :NEW.CUSTOMER_ID  
        FROM DUAL;   
      END IF;   
    END;   
    /
    
    
    
    

    When I try to insert several records with the seq.nextval it gives error

    violation of primary key.

    INSERT INTO "ALIZA"."SL_CUSTOMERS" (CUSTOMER_NAME) VALUES ('sdfsd')
    ORA-00001: unique constraint (ALIZA.SL_CUSTOMERS_PK) violated
    ORA-06512: at line 1
    
    
    
    
    One error saving changes to table "ALIZA"."SL_CUSTOMERS":
    Row 4: ORA-00001: unique constraint (ALIZA.SL_CUSTOMERS_PK) violated
    ORA-06512: at line 1
    
    
    
    
    
    
    
    

    Concerning

    Mr President.

    I find the solution by creating a function before the triiger

    as below

    CREATE SEQUENCE  "ALIZA"."SL_CUSTOMERS_SEQ"  MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 NOCACHE NOORDER  NOCYCLE ;
    
    CREATE OR REPLACE FUNCTION get_SL_CUSTOMERS_vId RETURN VARCHAR2 AS
    BEGIN
       RETURN SL_CUSTOMERS_SEQ.NEXTVAL;
    
    END;
    /
    
    CREATE OR REPLACE TRIGGER SL_CUSTOMERS_TRG
    BEFORE INSERT ON "ALIZA"."SL_CUSTOMERS"
    FOR EACH ROW
    DECLARE
    dummy VARCHAR2(200);
    BEGIN
      dummy := get_SL_CUSTOMERS_vId();
      :NEW.CUSTOMER_ID := dummy;
    END;
    /  
    

    It works very well

    Thank you all for the suggestions.

    Concerning

  • Can someone tell me what's wrong with my loop of consumer queue or producer?

    A Labview engineer helped me with the overall structure of my program, made necessary by the rapid sampling rate data and post-processing requirements. He recommended the producer/consumer, loop and using one of the example (Cont CQI graph - int clk voltage) files to actual data acquisition. So I put the loop on foot and spend my two channels of data acq past in the loop of the producer. However, nothing is get picked up in the loop of consumer and none of my data gets displayed there.

    Someone wants to take a look and let me know what I am doing wrong?

    It seems that the only time where you have to write the data in the queue (in the loop of the producer), when you stop the DAQ while loop or the acquisition of data generates an error.

    You may need to place the element from the queue node in the data acquisition while loop.

  • My video Html code does not work with chrome or firefox. What I am doing wrong?

    I am fairly new to this and am trying to embed a video from my computer in my site but when I publish it the html code that I use doesn't seem to work with firefox or chrome. What I am doing wrong?

    < object id = "MediaPlayer" width = "692" height = "690" type = "video/x-ms-asf" >

    < param name = "FileName" value = "S:\2015 Properties\2015 Active Properties\2494 Arnold Palmer Drive, Blaine MN 55449\Property Photos\Arnold Palmer - Video.mp4.en9r5uu.partial ' >

    < param name = "autostart" value = "false" >

    < param name = "ShowControls" value = "true" >

    < param name = "ShowStatusBar is preserved" value = "false" >

    < param name = 'ShowDisplay"value ="false">

    "" < embed type = "application/x-mplayer2" src = "S:\2015 Properties\2015 Active Properties\2494 Arnold Palmer Drive, Blaine MN 55449\Property Photos\Arnold Palmer - Video.mp4.en9r5uu.partial '.

    width = "692" height = "690" ShowControls = '1' ShowStatusBar is kept = "0" ShowDisplay = "0" autostart = "0" / >

    < / object >

    Hello

    As I see you are trying to add a MP4 video for Muse I advise you to use steps or widgets available in the link below

    link with the steps to add MP4

    How to integrate a mp4 video in my muse site.

    Free widget

    Musepen::HTML5 video player Widget

    Concerning

    Vivek

  • A few days, I bought a mac mini which I transferred the data and programs with time machine: programs have been updated except for iMovie, and now it seems that I have to pay for the update: possible? What I am doing wrong?

    A few days ago, I bought a mac mini and I transferred all my data and programs with time machine: all programs have been updated but iMovie (7.1.4)... However, it seems that, to update to the latest version, I have to pay to download on Appstore: is it possible? what I am doing wrong?

    If it were a new mac mini, you need already installed 10.1 iMovie.  Otherwise, but you already have iMovie 9 registered version to your Apple ID, you can upgrade to version 10 for free, but if (as it appears) is an earlier version then you have to buy version 10.

    Geoff.

  • Help! I did a movie with pictures on Movie Maker, played very well. Now, it's just to show Xs red in the photos of some, but not all. What I am doing wrong?

    I did a movie with pictures on Movie Maker and played very well.  Now, it's just to show Xs red in the photos of some, but not all.  What I am doing wrong?

    When you save your project, and then rename, move or delete a photo next time you open your project, you will see a red X where the photo was. Just a click with the right button on the X and select Remove then import your photo again under the new name or location and click on save project on the file menu.

    In the menu task under finished film click Save to my computer tracking instructions and your project will be saved as a movie.

  • I created a 'film' in Windows Movie Maker with audio. I'm now trying to burn on a DVD in windows DVD creation, but the program will change the order of my photos. What I am doing wrong?

    I took pictures of a Picasa folder and created a "slideshow" with audio in Windows Movie Maker. It's over, but when I try and save it to a dvd using windows DVD create, change the order of my photos are randomly. Am I missing a setting? What I am doing wrong?

    It may be interesting to try to publish (Save) project in the. Film WMV
    format in a folder on your hard drive. Then import them. WMV file in
    Creating Windows DVD.

    Windows Vista - publish a movie in Windows Movie Maker
    http://Windows.Microsoft.com/en-us/Windows-Vista/publish-a-movie-in-Windows-Movie-Maker

    Movie Maker Vista - Edition
    http://www.Papajohn.org/Vista-publishing.html

Maybe you are looking for