Random MovieClips does not work in HTML canvas

This code works for as3, but why it works not for HTML canvas?

Can someone help me?

var MovieArray:Array = new Array(btr,btg,bty);

for (var i: int = 0;  I < MovieArray.length;.  i++){

var RandomNumber:Number = Math.floor (Math.random () * MovieArray.length)

var MoviePosX:Number = MovieArray [NombrAl] .x;

var MoviePosY:Number = MovieArray [NombrAl] there;

MovieArray [NombrAl] .x is MovieArray [i] .x;.

MovieArray there [NombrAl] = there MovieArray [i];

MovieArray [i] .x = MoviePosX

MovieArray [i] = MoviePosY there

}

There are still a few errors in your code. Use it instead:

var MovieArray is [this.btr, this.btg, this.bty];.

for (var I = 0; i)< moviearray.length;="" i++)="">

var NombrAl = Math.floor (Math.random () * MovieArray.length)

var MoviePosX = MovieArray [NombrAl] .x;

var MoviePosY = MovieArray [NombrAl] there;

MovieArray [NombrAl] .x is MovieArray [i] .x;.

MovieArray there [NombrAl] = there MovieArray [i];

MovieArray [i] .x = MoviePosX;

MovieArray [i] there = MoviePosY;

}

In general, during the transition from AS3 to JS, you must make the following changes mainly:

1. all instance names must be referenced as 'this principaltype.instance-name '.

2. all the ': type' prescribers should be deleted.

Tags: Adobe Animate

Similar Questions

  • Why gmail does not work in HTML more like it did before someweeks?

    Until several weeks ago, GMAIL has worked very well in HTML. Then, after a new version of Firefox, it worked only in the version low resolution. This has happened after a version change, but he corrected after the next change of version.
    This time he still does not HTML even after several changes of version!

    What can be the reason for this?

    Clear the cache and cookies from sites that cause problems.

    "Clear the Cache":

    • Tools > Options > advanced > network > content caching Web: 'clear now '.

    'Delete Cookies' sites causing problems:

    • Tools > Options > privacy > Cookies: "show the Cookies".

    Also, make sure that you are not blocking cookies for Gmail site (Google).

    • Tools > Options > privacy > Cookies: Exceptions
  • Math.Random () does not work in BB

    Salvation;

    I just want to ask if the BB API, can give the possibility to generate a number of random if yes how can I do; generally in java J2SE: I CAN DO THIS:

    choice = (int) (Math.Random () * 3 + 1);

    "to generate a random number ' 3 nomber.

    I try to do whit BB I import java.lang.Math;

    and when I try to put Math.Random (), it does not work

    can anyone give me the solution?

    in fact I want to have a HEX number, I think I have the Random one after I'll transforms in HEXA.

    Thank you very much

    Here is exactly what you need to get a random number

    first import

    import java.util.Random
    

    then

    //Random number generator
        Random dice = new Random();
        int num = 0;
        for (int counter=1; counter<=1000; counter++){
            num = dice.nextInt(1000); //it will generate numbers up to 1000
        }
    

    You are welcome!

  • .swf works but .exe projector does not work

    Hi all

    I was just wondering what I'm doing wrong.  My .swf file works great _ (with FLV player and cuepoints) but when I do a projector .exe files in the same folder all or a sudden the FLV player does not work properly.  It's in the same place so all the nav for the films should be the same.

    any tips?

    See you soon

    void

    OK has soon.  None does not work the Html code.  I use AS3 edition to the latest version of flash player 10.2, but change the settings here does not help when even (I tried versions earlier)

    I have wrkaround by clips separated instead of use the Commissioner, I am now using a. FLV player and use .source = "whatever".

    to load different if necessary clips.  Seems to work.

    I would like to know how to use seekToNavCuePoint with FLV file player and projector that I would use this feature in the future.

    Thank you

    void

  • Audio HTML does not work, no way to solve this problem simply, without having to learn code or whatever it is me?

    Audio playback on SoundCloud attempt does not work for me, as well as other sites that make use of audio HTML. All that happens is that weird squeaky seems to start playing, and then Firefox will crash eventually. It works fine when I try it in other browsers.

    • Firefox 38.0.1 Crash report [@ mcmpgdec.dll@0x5ac28]

    What is the installation path of the file mcmpgdec.dll if you search for this file?

    That will tell you what software is causing this issue.

  • How to import a bookmarks.html file? Bookmarks &gt; organize bookmarks &gt; import and backup does not work.

    After trying to import my favorites saved in an html file, using bookmarks > organize bookmarks > import and backup > import html, nothing is being updated from saved files

    This isn't "machine code", it's like a JSON backup file is formatted (except it usually shows no line breaks, it's a long line when displaying in most text programs or in Firefox). Rename a JSON file as HTML does not work, the formats are completely different.

    If you replace this file in jsonextension, you should be able to restore these data in Firefox.
    Bookmarks > organize bookmarks-> import and backup - restore - Choose file...

  • Here's a strange. I have a HTML page with this time a wmv video. It works perfectly from a USB stick or SD card, but does not work when they are copied to the hard drive

    I have an HTML page created with web expression 4. It contains only a wmv video. It works perfectly when it is called from a USB stick or SD card, but does not work when they are copied to the hard drive. The results are the same with IE and Firefox. It don't make no difference if I use Media Player V9 or V11. He has no control on the page Media Player. Video and html files are in the same directory. Here is the code snippet:

    LIFT, DRAG, THRUST and GRAVITY










    If I run it on a machine with Win 7 there is no problem.

    Richard Grosser

    Hi Richard c. Grosser,.

    Your question is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for the IT Pro TechNet public. Please post your question in the Microsoft Expression forums.

    http://social.expression.Microsoft.com/forums/en-us/categories

  • HTML (file .oam) video does not work on mobile devices when publication of draft 9 Captivate

    Hello

    I have created a project of 9 Captivate and publish HTML5 so that it works on mobile devices. I would like to include a short video on one of my slides, so I imported a file .oam (that I exported to animate CC) in my Captivate project. I thought given that the video was an animation HTML that it would go very well on mobile devices, however when I run the project on an iPad a box indicating I have need flash player appears where the video should play. I thought the very idea of HTML that it can run without flash player, so run on mobile devices? Am I missing something obvious?

    Thank you!

    I think I only know why this process was not working for me. Although the file was published as a file .oam and built in CC host the file type I was exporting to was a .swf file and not a file HTML canvas. I have since built in CC animations animate HTML canvas files and they work very well in 9 Captivate.

  • Calling a Flex action when you display a view html Bridge does not work

    Hello

    I have a second question.

    Our plug-in displays a view of the hosts using the html bridge code.  When our view is active and the user

    call the context menu in the Navigation on the left - and attempts to perform an Action (for example: Host disconnect).

    the container (IFrame) in which appears our point of view, is made to have a bright white background, and the action does not work

    work - no dialog boxes don't start or anything like that.

    Is there anything I can do to prevent this?

    Thanks for some tips more

    Cathy

    Hi Laurent,.

    I made a Plugin Acme - it does nothing except show a label and a text.  Then I added this to my plugin.xml for a host.

    The first photo shows just the plugin at the beginning.  Then I call the contextmenu - and select "Disconnect" - the third watch

    what looks like the view, and it's normal 'disconnect' are you sure... box is not running...

    But I noticed that I use the sdk 6.0ga - so maybe I should try with update 1?

    But for our production, we use the sdk 5.5, because it must operate on 5.5 as well.

    I also tried another host of Actions, such as alarms-> new alarm definition - but that works properly.  I don't know what could be the difference.

  • 960px simple html does not work?

    I have b een coding of pages a while but it's puzzled me.

    I have a page with simple code:

    <! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional / / IN".

    " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.DTD "> "
    " < html xmlns =" http://www.w3.org/1999/xhtml ">
    < head >
    < meta http-equiv = "Content-Type" content = text/html"; charset = utf-8 "/ >"
    < title > Untitled Document < /title >
    < style type = "text/css" >

    {#960Wrapper}
    Width: 960px;
    background-color: #0F0;
    margin-right: auto;
    left margin: auto;
    }
    #header {}
    background-color: #C9F;
    }
    #footer {}
    background-color: #C0F;
    }
    < / style >
    < / head >

    < body >

    < div id = "960Wrapper" > content for id WrapperPage goes here

    < div id = "header" > this part is reserved for the logo < / div >

    < div id = "contentArea" >
    < p > please click a button: < /p >
    < / div >

    < div id = "footer" > this part is reserved for the footer < / div >

    < / div >

    < / div >
    < / body >
    < / html >

    However everything goes full width and edge of the browser - all of them.

    Maybe my grey cells are tired - or something is damaged but the machine won't accept - in or out of dreamweaver.

    I rebooted - run ccleaner and restarted again, but something does not work for me.

    I would be grateful if someone could confirm that I don't go crazy if you please.

    Terry

    #960Wrapper

    A class or ID name must not start with a number.

  • Flexible browser width does not work when exported to HTML format and transferred. Muse CC 2014

    Hello

    This used to work, and then he stopped. Not sure when it stopped working, so I can't cancel everything I could have messed with.

    In the preview in the browser page, the bottom of the page is flexible and works very well.

    But when I export HTML and upload, it does not work.

    Help, please.

    I saw the site in several browsers and no luck.

    The site is below.

    Why Coyle

    Thank you

    Gene

    Hello Gene,

    I checked the page code for the page that does not work. It seems that you have inserted your CSS custom page, screen shot - http://prntscr.com/45vndu, which is in conflict with the Muse generated CSS. Delete this and let me know how it goes.

    - Abhishek Maurya

  • Responsive HTML5 with mergedprojects, creates a hyperlink to a file in the project html parent to a child html file and it does not work! The child has with the parent TOC, but need to tie. Help, please!

    Hi group!

    I have a brilliant parent project that serves as a springboard for other projects. Users click a component of software they want and are redirected to a page with a list of all the documentation available for this component. Click on the name of a document and access - a lot of PDF files. BUT I also wish they were able to tie the online help for the component. After having read up on the link through / between projects, I knew that I needed to create a parent project (for the page intro and links brilliant) and projects for children (for software components).

    THEN

    I created a parent sensitive HTML5 project and the projects of two children. I compiled the parent to create mergedprojects files, and then open the projects children and collected to the appropriate mergedprojects folder. I then created a hyperlink to the file list html documentation in the project parent towards the child file software component html (output folder and start page [which is the same as the default theme]) and the link does not work! The child and its table of contents appears in the parent TOC so topics are here, but I can't link to them. If necessary, I can send screenshots.

    Where I am dorking this place?

    Thanks in advance for your time and help!

    Scottie 'needs help' gear

    What is your relationship like? And how did you create the link?

    A typical reactive merged help is structured as follows:

    index.htm (Master home page)

    mergedProjects

    childName

    index.htm (starting page for child)

    A child from the index.htm page link would look like this:... /... index.htm

    Kind regards

    Willam

  • In the html content of dps, it has a url link to a pdf file. When click on url to load the pdf file, the zoom does not work

    I load html content in an application of dps.

    In the html page, there is a url to a pdf file. When I click on the url, the page loads a pdf file.

    Here's the question: is able to zoom in pdf?

    It's difficult because I can zoom in the first html page, but when I load a pdf file, zoom effect does not work.

    Please let me know if this is a way to make the pdf was able to zoom in.

    Thank you

    Post edited by: monsteryu

    No, this is not possible.

    Neil

  • HTML export does not work in my host.

    HTML export does not work in my host.

    The program works very well. Look in the browser preview and published in businesscatalyst, but when I export to html and upload it to my server is bad, just misguided.

    Try to rename the master of the CSS css/master_a-p%c3%a1gina-maestra.css?fileVersionPlaceholder

    Your server reports an error 404. "The requested URL /css/master_a-pagina-maestra.css was not found on this server."

    I have a normal design for print so I'm not sure of the exact cause, but maybe the name of the file is lost in translation?

    J

  • MovieClip (root) does not work inside a function

    Hey everybody,

    I'm having this problem.

    When I publish my FLA with reader 9, in fact, there is no prob.

    When I publish with player 10 selection, there is this problem.

    I paste my code:

    var leng:int = MovieClip(root).program.websiteXML.pages.titlePage.length();
    trace ("leng"+leng);
         
    setInterval(function () : void {
    
              if (MovieClip(root).program.autoCh==true){
                           
               trace("CHANGE");
                                
              
              MovieClip(root).allContent.controllMenu2['itemButton_' + MovieClip(root).program.linkPic].gotoAndPlay("s4");
              
              if (MovieClip(root).program.linkPic < int(leng-1)){
                        MovieClip(root).program.linkPic++;
                           }else{
                               //MovieClip(root).allContent.play ();
                             MovieClip(root).program.autoCh=false;
                             MovieClip(root).program.linkPic=1;
                             }
                           
                   
                             MovieClip(root).allContent.controllMenu2['itemButton_' + MovieClip(root).program.linkPic].gotoAndPlay("s4");
                             
    
                             
                             
                             for (var z:uint=1; z<(MovieClip(root).program.linkPic+1); z++) {
                                  var tempMC:MovieClip = MovieClip(MovieClip(root).allContent.controllMenu2)["itemButton_"+z];
                                  Tweener.addTween(tempMC, { x:(z-1)*(45+1)-353, time:1} );     
                                  
                             }
                             
                             for (var j:uint=(MovieClip(root).program.linkPic+1); j<7; j++) {
                                  var tempMC2:MovieClip = MovieClip(MovieClip(root).allContent.controllMenu2)["itemButton_"+j];
                                  Tweener.addTween(tempMC2, { x:(j-1)*(45+1)+352, time:1} );     
                                  
                             }
                             
                             MovieClip(root).allContent.controllMenu2['itemButton_' + MovieClip(root).program.linkPic].gotoAndPlay("s3");
                             
                        
    
                       }}, 4000);
    

    For variable coz, there is no problem, the value is retrieved.

    But it is inside SetIntervall, to

    MovieClip(root).program.autoCh

    He tells me that:

    TypeError: Error #1009: cannot access a property or method of an object reference zero.
    function / < anonymous > () [main6_cs3_fla._00button_136::frame1:32]
    service / http://adobe.com/AS3/2006/builtin: applies ()
    to SetIntervalTimer / onTimer)
    at flash.utils::Timer/_timerDispatch()
    at flash.utils::Timer/tick()

    And if I put the value outside the function:

    var autoChtest = MovieClip(root).program.autoCh;

    And use:

    if (autoChtest==true)

    There are no errors, but my function does not work properly, as native can be 'false' in another action.

    Well, I hope that will not scare you, and someone will try to help me, please.

    If anyone knows anything on this topic post or having the same problem please tell me.

    Thank you!

    Try:

    :

    var leng:int = MovieClip(root).program.websiteXML.pages.titlePage.length();
    trace ("leng"+leng);
    
    var rootVar:MovieClip=MovieClip(root); 
    setInterval(function () : void {
    
              if (rootVar.program.autoCh==true){
    
               trace("CHANGE");
    
             rootVar.allContent.controllMenu2['itemButton_' + rootVar.program.linkPic].gotoAndPlay("s4");
    
              if (rootVar.program.linkPic < int(leng-1)){
                       rootVar.program.linkPic++;
                           }else{
                               //MovieClip(root).allContent.play ();
                             rootVar.program.autoCh=false;
                             rootVar.program.linkPic=1;
                             }
    
                            rootVar.allContent.controllMenu2['itemButton_' + rootVar.program.linkPic].gotoAndPlay("s4");
    
                             for (var z:uint=1; z<(MovieClip(root).program.linkPic+1); z++) {
                                  var tempMC:MovieClip = rootVar.allContent.controllMenu2)["itemButton_"+z];
                                  Tweener.addTween(tempMC, { x:(z-1)*(45+1)-353, time:1} );     
    
                             }
    
                             for (var j:uint=rootVar.program.linkPic+1; j<7; j++) {
                                  var tempMC2:MovieClip = rootVar.allContent.controllMenu2)["itemButton_"+j];
                                  Tweener.addTween(tempMC2, { x:(j-1)*(45+1)+352, time:1} );     
    
                             }
    
                            rootVar.allContent.controllMenu2['itemButton_' + rootVar.program.linkPic].gotoAndPlay("s3");
    
                       }}, 4000);
    
    

Maybe you are looking for