Could someone help me out? ActionScript

import flash.display.MovieClip;
var clip:clip01 = new clip01;
var clip2:clip02 = new clip02;
var clip3:clip03 = new clip03;
var clip4:clip04 = new clip04;
var clip5:clip05 = new clip05;
var files:Array = [clip,clip2,clip3,clip4,clip5];
function randomizeArray(array:Array):Array
    var newArray:Array = new Array();
    while (array.length > 0)
newArray.push(array.splice(Math.floor(Math.random()*array.length), 1));
    return newArray;
var RandomArray:Array = randomizeArray(files);
trace(RandomArray[0]);
trace(clip);
var c:MovieClip = MovieClip(RandomArray[0]);
addChild(clip); // it’s OK
addChild(c); // I get the error msg bellow:
Scene 1, Layer 'movies', Frame 1, Line 29              1118: Implicit coercion of a value with static type Object to a possibly unrelated type flash.display:DisplayObject.
Could someone help me out?
I cannot add MovieClip on the stage from the array.

I have done till this the following code bellow. I’d like movie clip on the
stage to be playing one after another in a randomized order in a loop. I
used a timer, but this solution is not good, because the movies are not
playing till the end. I need an EventListener to listen the end of the clip.
How this code could be modified to work well, could you give me a solution
to this problem?
import flash.display.MovieClip;
var clip1:clip01 = new clip01  ;
var clip2:clip02 = new clip02  ;
var clip3:clip03 = new clip03  ;
var clip4:clip04 = new clip04  ;
var clip5:clip05 = new clip05  ;
var files:Array = new Array();
pushArray(clip1,clip2,clip3,clip4,clip5);
function pushArray(c1,c2,c3,c4,c5:MovieClip){
                files.push(c1);
                files.push(c2);
                files.push(c3);
                files.push(c4);
                files.push(c5);
function randomizeArray(array:Array):Array
                var newArray:Array = new Array();
                while (array.length > 0)
                                newArray.push(array.splice(Math.floor
                                (Math.random()*array.length), 1)[0]);
                return newArray;
var RandomArray:Array = randomizeArray(files);
var testTimer:Timer = new Timer(1000);
testTimer.addEventListener(TimerEvent.TIMER,updateFile);
testTimer.start();
function updateFile(event:TimerEvent):void
                if (RandomArray.length == 0)
                                pushArray(clip1,clip2,clip3,clip4,clip5);
                                RandomArray = randomizeArray(files);
                trace('play file',RandomArray[0]);
                RandomArray.shift();
//RandomArray[0].addEventListener(Event.ENTER_FRAME, VideoFinished);
function VideoFinished(e:Event):void {
     if (RandomArray[0].currentFrame==RandomArray[0].totalFrames) {
          trace("finished");
//addChild(RandomArray[0]);

Similar Messages

  • Could someone help me out how to insert a Node properly into a DOM?

    I am trying to insert a Node built from a String to a DOM.
    Here is how I created the Node
                   Detail = "<Detail><Msg>Detail Message</Msg></Detail>";
                   prolog = "<?xml version="1.0" encoding="UTF-8"?>";
                   Node DetailNode = null;
                   Document DetailDoc = null;
                   if( Detail != null ){
                        Detail = prolog + BiometricDetail;
                        DetailDoc = xp.XML2DOM( BiometricDetail ); // transform a XML String into a DOM.
                        DetailNode = BiometricDetailDoc.getDocumentElement();                    
    Here is how I created the DOM
                   javax.xml.parsers.DocumentBuilderFactory factory = javax.xml.parsers.DocumentBuilderFactory.newInstance();
                   javax.xml.parsers.DocumentBuilder builder = factory.newDocumentBuilder();
                   Document document = builder.newDocument();
                   Element beeE = document.createElement("BeeSets");
                   Element grpE = document.createElement("Group");          
                   bioE.appendChild( grpE );
                   // the document looks like "<BeeSets><Group></Group><BeeSets>";
                   // After inserting the Node DetailNode, I want it to look like
                   // "<BeeSets><Group><Detail><Msg>Detail Message</Msg></Detail></Group><BeeSets>";
    Now when I tried to insert the node DetailNode to the DOM document, I tried
    1) document.importNode( DetailNode, true );               
    No exception was thrown. But when I transformed the DOM document back to a String, I could not see the information from the newly imported Node DetailNode.
    When I tried
              grpE.insertBefore( BiometricDetailNode, dataE );
    I got the following exception.
         org.w3c.dom.DOMException: WRONG_DOCUMENT_ERR: A node is used in a different document than the one that created it.
         at org.apache.xerces.dom.ParentNode.internalInsertBefore(Unknown Source)
         at org.apache.xerces.dom.ParentNode.insertBefore(Unknown Source)
         at com.jadcs.bioidentity.role.base.RP.getNodes(RP.java:497)
    2) document.adoptNode( DetailNode );
    I got the following exception.
         java.lang.ClassCastException: org.apache.xerces.dom.DocumentImpl
         at org.apache.xerces.dom.DeferredTextImpl.synchronizeData(Unknown Source)
         at org.apache.xerces.dom.NodeImpl.setOwnerDocument(Unknown Source)
         at org.apache.xerces.dom.ParentNode.setOwnerDocument(Unknown Source)
         at org.apache.xerces.dom.ElementImpl.setOwnerDocument(Unknown Source)
         at org.apache.xerces.dom.ParentNode.setOwnerDocument(Unknown Source)
         at org.apache.xerces.dom.ElementImpl.setOwnerDocument(Unknown Source)
         at org.apache.xerces.dom.CoreDocumentImpl.adoptNode(Unknown Source)
         at com.jadcs.bioidentity.role.base.RP.getNodes(RP.java:509)
    3) detailStr = "<Detail><Msg>Detail Message</Msg></Detail>";
    Element detailE = document.createElement("Detail");
    detailE.setTextContent( detailStr );
    grpE.appendChild( detailE );
    This way gives result like "<BeeSets><Group><Detail><Detail><Flash>On</Flash></Detail></Detail></Group><BeeSets>";
    The content is messed up.
    Could someone help me out at how to insert a Node properly into a DOM? Thank you very much.

    Said another way, importNode actually only makes and returns a copy of the node you gave it (it will be a deep copy only if you pased true as the second parameter), but where the new dom you called import on is owner.
    So what you need to do is more like this:
    Node tempNode = domYouAreAddingTheNodeTo.importNode(node2copy,true); //true if you want a deep copy
    domYouAreAddingTheNodeTo.appendNode(tempNode);You can also traverse to any point in the DOM and insert the node there with the same method, but you always have to import first so that the DOM has a copy of the node that it owns.

  • My iPod doesn't seem like enjoy working, could someone help me out?

    This is my second iPod (I had to send the first one back to get it replaced) and it's getting ridiculous. About three months ago it stopped working again (the new one) and I got a box to send it back, but I tried installing new software and updating it and all, which fixed it, or so I thought. Now it's not working again. I can't even get it connected to my computer without the computer freezing completely. iTunes refuses to load when the iPod is connected, and "My Computer" (I have a win laptop) quits responding when I connect it too. If I could get it connected I would reset it completely, which I don't midn doing, but it doesn't seem to be able to do that. Has anyone else had this problem? I'd really appreciate help with this problem because Apple says I can't send it back... even though it's my second one. Any help would be appreciated greatly. Thanks in advance.
    -FF
    the ipod was bought for christmas last year (04), and is a click wheel, but not a color photo, or vid ipod.

    This is my second iPod (I had to send the first one back to get it replaced) and it's getting ridiculous. About three months ago it stopped working again (the new one) and I got a box to send it back, but I tried installing new software and updating it and all, which fixed it, or so I thought. Now it's not working again. I can't even get it connected to my computer without the computer freezing completely. iTunes refuses to load when the iPod is connected, and "My Computer" (I have a win laptop) quits responding when I connect it too. If I could get it connected I would reset it completely, which I don't midn doing, but it doesn't seem to be able to do that. Has anyone else had this problem? I'd really appreciate help with this problem because Apple says I can't send it back... even though it's my second one. Any help would be appreciated greatly. Thanks in advance.
    -FF
    the ipod was bought for christmas last year (04), and is a click wheel, but not a color photo, or vid ipod.

  • Could someone help me out, and kinda give me a walk through.

    I have a video in quicktime format, and everytime ive converted it to MPG4, the audio is early and the video is late. So my question is, how do i fix this?

    did you try using this software.it might prove better in converting.
    To use Videora iPod Convertor to convert movies for use on your iPod, consult these helpful links:
    To get started: http://www.videora.com/en-us/Converter/iPod/
    If you have questions: http://www.videora.com/en-us/Converter/guides.html
    If you have more questions, post them here: http://www.pspvideo9.com/forums/index.php?c=8
    Note that Videora iPod Convertor is a 3rd party program. If you need help with it, post your question there.
    GFF

  • Could someone help me out?

    Hi,everybody:
    I don't familiar with Solaris and OAS any more,in fact I'm a freshman in this field.But recently I've done a JAVA project and its enviroment is Solaris 5.7 and OAS R.4.0.8.2.
    I wanna ask you some questions if not bother you:
    1: Can OAS be used as Application Server and Http Server simultaniously?
    2.How to set the Http Listener in Solaris?
    3.Has OAS any administrator functions like IIS site management? And how to get it shown?
    4.How can we get a detailed OAS manual and a Solaris Operating manual?I can't find a suitable one from the site?
    Ah... Too many questions,really sorry to take your time,but I'm really in a hurry.In my experience,I often use Windows but not Linux or Solaris,and use VB,ASP but not JAVA.So I am a beginner here and the question maybe too easy to you.^_^
    Waiting your help.Thanks

    Wei,
    A forum is not the place to learn new technologies. If you are new to
    Oracle and java, then you are going to have to either do some serious
    reading or attend some courses (or both). You have abundant resources
    available to you, but if you are serious about becoming proficient in
    these technologies, then there is only one way to do it -- investing
    time and effort in learning them. As I said before, in order to learn
    them, you need to read, attend courses and practice.
    In my opinion, the task of the forum is to supply specific answers for
    specific questions (like,'what JAR file do I need to add to my CLASSPATH?')
    and not,'please provide a step-by-step tutorial on how to create,
    deploy and execute a web-based J2EE application using Oracle and
    JBuilder'.
    If you want help locating appropriate resources, I can offer you
    suggestions (like those I mentioned in an earlier post).
    Good Luck,
    Avi.

  • I would like to change the owners name on my ipad2 to my daughters name and credit. Could someone help me figure this out?

    I would like to change the owners name on my ipad2 to my daughters name and credit. Could someone help me figure this out?

    Sign out from Find My Phone in iCloud, and sign out from your Apple ID in Settings/iTunes & App Store
    Then setup as a new phone with iTunes and when your Daughter sets it up for the first time she can add or set up her own Apple ID.
    Cheers
    Pete

  • I have a Mac mini Snow Leopard. In Numbers the grid lines are so faint that they are barely visible. Please could someone help me sort out this problem.

    I have a Mac mini Snow Leopard. In Numbers the grid lines are so faint that they are barely visible. Pleease could someone help me sort out this problem?

    The User Manual has this:
    Formatting Table Cell Borders
    You can change the line thickness and color of table cell borders. Or you can hide the border of any cell.
    To format table cell borders:
    1 Select the cell border segments you want to format.
    2 Use the controls in the format bar or in the Table inspector.
    Click to choose a stroke color.
    Click to choose a stroke style.
    Click to choose a line thickness.
    Stroke pop-up menu:  Lets you choose a stroke style. Choose None to hide borders.
    Line thickness:  Controls the thickness of the stroke.
    Color well:  Lets you choose a stroke color.
    When you click the color well in the format bar, a color matrix appears. Select a color by clicking it in the matrix, or click Show Colors to open the Colors window for additional color options.
    When you click the color well in the Table inspector, the Colors window opens.
    User Guide: http://manuals.info.apple.com/en_US/Numbers09_UserGuide.pdf

  • Could someone help me with instructions for doing a clean install for iMac with mountain lion 10.8.4 ?

       Could someone help me with instructions for doing a clean install for Could someone help me with instructions for doing a clean install for an early 2009 iMac 20"  with Mountain Lion 10.8.4 ?
       Thank You,
                                leetruitt

       Barney,  William,  nbar, Galt\'s Gulch:
       A nephew stayed with us to take a course at the local community college last semester. I allowed him use of my mac for research just after I installed Mountain Lion. He decided to "help out" and ran a 3rd party clean and tune up app., Magician.  The tune up wiped over 1200 titles of my music in iTunes,  also a path of folders with names containing nothing but more empty folders with names. Almost every program I open and run for a short time crashes, also folders and programs are in wrong places, or cannot be located (the nephew, for instance). Up to this time I have always been able to track a problem far enough to resolve it by careful persistence and good luck, but I do not have the tech savvy to solve this one without getting in deeper. I have run disk utility saveral times and always get  variations of this:
    ACL found but not expected on
    "private/etc/resolve.conf"
    "private/etc/raddb/sites-enabled/inner-tunnel"
    "private/etc/rabbd/sites-enabled/control-socket"
         Also, after four years of intense daily use it is cluttered with much junk,  and every app that I was curious about, and I am a very curious guy.
       So I know my limits, (and now my nephew). I dumped my pc for a Strawberry iMac a few years ago, and so far every problem I've encountered, or brought on myself, the Mac has resolved with its own inner elegance - in spite of my novice bungels - and now I honestly feel ashamed, in addition to the need to apologize to a machine for allowing a peasant into the Royal Grounds - so I am calling the Wise Ones in for this one.
       Crazy, I know, but to me a Mac represents something far beyond the ordinary  input ➛ process  ➛ output  title/function customarily assigned to a machine - I sense an odd kind of morality involved, one that I need to respect.
        So, these are my reasons for wanting to do a clean install, correctly.
            Thank you,  Truitt

  • HT3702 I'm trying to open an iTunes account and was asked to provide one of each:credit card details or gift card details.i provided a gift card details and yet I'm being asked to contact the support team!!! Pls can someone help me out on this..thanx. Bre

    I'm trying to open an iTunes account and was asked to provide one of each:credit card details or gift card details.i provided a gift card details and yet I'm being asked to contact the support team!!! Pls can someone help me out on this as I cant enjoy my new iPad 3 without buying apps

    Brenda, the easiest way to contact the support team is thru the iTunes Customer Service website:
    http://www.apple.com/support/itunes/contact/

  • Could someone please sketch out this simple script for me?

    Could someone please sketch out a simple java script for me. I will have a document with one background
    layer and a layer set (group) called "Analyze" that consists of 63 adjustment layers. The layer names in that "Analyze" group(folder) will be
    "01" ...through "63" with 01 on the bottom and 63 at the top. Initially, all of the adjustment layers will be invisible and  the
    group will be closed (not expanded). I need a simple  script that will check for the first invisible layer in that group
    and make it visible without selecting that layer nor expanding the group. The script has to check
    for the first invisible layer every time it runs because other actions may have turned off a layer in the set.
    The point of this is so I can hotkey flipping on the layers one at a time without expanding the set or
    changing focus off the  background. It seems it should be a simple loop, but I just can't wrap  my head
    around all the objects (e.g. Layer as opposed to Layers  and  Artlayer as opposed to Artlayers)
    and the constants constants.
    for (i = 63; i>0; i--){                 /* I have found layer indexes 0 are the topmost layer */
      if( layerset[i] == INVISIBLE){
               layerset[i] = VISIBLE;
                  break;
    Could someone please write me a simple script that would do this?
    Edit I found this and its very close to what I need:
    var doc = app.activeDocument;
    for(var i = 0 ; i < doc.layers.length;i++){
      doc.layers[i].visible = (i % 2 == 0);
    From here : Function to show/hide layer with Photoshop script (JSX) - Stack Overflow
    In my case I would rewrite it to this
    for(var i = 62; i >=0; i--){
         if(  !doc.layers[i].visible){
              doc.layers[i].visible =TRUE;
              break;
    My problem is I just need  to traverse the layers in my layerset "Analyze"
    How do  I reference just those? Is there a doc.layersets["Analyze"].layers[i].visible = TRUE?
    Message was edited by: Shawn Laughlin To add more information

    Well this works:
    var doc = app.activeDocument;
    var analyze = doc.layerSets.getByName("Analyze").layers
    for(var i = 62 ; i >= 0; i --){
        if (!analyze[i].visible){
            analyze[i].visible =1;
            break;
    Hard to believe TRUE is not a constant in java.

  • HT4528 Im trying to update my apps. And it telling me i purchased them once i go to sign in to update them, i sign in and it goes straight to my account and all im trying to do is update my apps. Can someone help me out to updare my apps . Thanks

    Im trying to update my apps. And it telling me i purchased them once i go to sign in to update them, i sign in and it goes straight to my account and all im trying to do is update my apps. Can someone help me out to updare my apps . Thanks

    Sweetsusieq wrote:
    ... i sign in and it goes straight to my account ...
    And... What seems to be the problem...?

  • Hi could someone help me please ? Ive just bought the new ipad and want to put some movies on it. I have already converted some movies using handbrake and tried to transfer them to my ipad and it just wont work. ive tried drag and drop and everything

    Hi could someone help me please ? Ive just bought the new ipad and want to put some movies on it. I have already converted some movies using handbrake and tried to transfer them to my ipad and it just wont work. ive tried drag and drop and everything

    bluztoo wrote:
    Haven't really used any of them including VLC - actually use netflix on the ipad more than anything. I was able to drop an mp4 into imovie on my ipad and see it there. This was something I had shot as avhcd and converted with turbo.264. Played fine. Probably not what you want for a movie player though.
    Well, turbo.264 is indeed very nice to have - even for converting full-sized movies. (Nevertheless, TechRadar's latest roundup (see http://www.techradar.com/news/software/applications/6-of-the-best-video-converte rs-for-mac-1074303 ; also linked from another roundup at http://www.iphonelife.com/blog/87/benchmark-excellent-multimedia-converter-handb rake-vs-commercial-apps ) has shown it's still worse than HandBrake in most respects.)
    All H.264 files (assuming they are H.264 level 4.1 or lower) are compatible with the built-in Videos app.
    bluztoo wrote:
    Those of you who use other players, what do you reccomend? Just curious.
    It entirely depends on your needs. The top players (AVPlayerHD / ProPlayer, It's Playing, GoodPlayer) all have different strengths and weaknesses. I myself use It's Playing the most as I convert everything into MP4 and simply love the DSP's (brightness / volume / saturation boosting). (Its software decoders are definitely worse than those of AVPlayerHD / ProPlayer; however, MP4's are played back from hardware.)

  • I have had a update on my mini ipad and its asking for a code could you help me out please

    I have got a iPad mini a update has come though and its asking me for a code when i click update could you help me out please

    TheArtificialNerd wrote:
    I can say 100% that the AppleCare phone number only redirects to other AppleCare groups.
    ALL of them Apple corporate or Apple Authorized partners.

  • I purchased a digital itunes giftcard through paypal but can't seem to find a 'code' to use to redeem the card. Could someone help me find where that code would be found? I can see the paypal transaction details.

    I purchased a digital itunes giftcard through paypal but can't seem to find a 'code' to use to redeem the card. Could someone help me find where that code would be found? I can see the paypal transaction details. jgm22

    -> iTunes Cards & Codes

  • I have  Mac os x 106. When I try to send an attachment with email it won't send.  Please could someone help? Thank you.

    I have a Mac OS X 10.6 When I try to send an attachment with email it won't send - keeps saying 'fail'.  Please could someone help? Thank you.

    Hi lllaass! I replied to your post with the information you required but haven't heard from you since. If you don't, or can't help any further please would you let me know. Thanks.

Maybe you are looking for

  • Having abends issues. Netware 6.5 with Support Pack 8.

    Novell Open Enterprise Server, NetWare 6.5 PVER: 6.50.08 Server POSEIDON halted Wednesday, August 31, 2011 1:49:48.023 pm Abend 1 on P00: Server-5.70.08: Invalid Opcode Processor Exception Registers: CS = 0008 DS = 0023 ES = 0023 FS = 0023 GS = 0023

  • There was a problem reading this document (135)

    I am running on Windows XP SP3 32 bit using reader 9.3.3 I have a PHP application which has been creating PDF documents successfully for several years, but now I am getting one particular document which I cannot read at all. All I see is the followin

  • CTRL + ALT + BACKSPACE or F1, F2, etc lock

    I've read many posts from this forum about this subject, tried every suggestion, but the things remains the same: After X has started, the combination of keys ctrl + alt +F1 or any other vc combination gives me a black screen, idem for ctrl + alt + b

  • Amount OF ringtones allowed at once..??? help

    I have 18 right now in my ringtones for my iphone but when i try to add more they dont appear there...is there a certain amount allowed at once?...help??? and can we change the tones for the textmessages as well??..anyone who has info on this please

  • How to power down unit

    How to power down unit when not in use?