Going to another frame after all items are in place

Hello All!
I'm making some simple drag'n'drop games and am using this code to make it work:
package
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    public class Main extends Sprite
        var xPos:int;
        var yPos:int;
        public function Main():void
            addListeners(s1, s2, s3, i1, i2, i3, n1, n2, n3, p1, p2, p3, b1, b2, b3, f1, f2, f3);
        private function getPosition(target:Object):void
            xPos = target.x;
            yPos = target.y;
        private function dragObject(e:MouseEvent):void
            getPosition(e.target);
            e.target.startDrag(true);
        private function stopDragObject(e:MouseEvent):void
            if (e.target.hitTestObject(getChildByName(e.target.name + "Target")))
                e.target.x = getChildByName(e.target.name + "Target").x;
                e.target.y = getChildByName(e.target.name + "Target").y;
            else
                e.target.x = xPos;
                e.target.y = yPos;
            e.target.stopDrag();
        private function addListeners(... objects):void
            for (var i:int = 0; i < objects.length; i++)
                objects[i].addEventListener(MouseEvent.MOUSE_DOWN, dragObject);
                objects[i].addEventListener(MouseEvent.MOUSE_UP, stopDragObject);
s1, s2, s3, i1, i2, i3, n1, n2, n3, p1, p2, p3, b1, b2, b3, f1, f2, f3 are objects that need to be placed correctly to win. So when they are placed correctly, what do I do to make the game recognize that the player did everything right? I'd like the game to be able to take it to another frame where a "win" graphic can be seen.
Any suggestions?

Ok people, my code looks like this now, there are no compiler errors, but how can this help me go to the next frame? Sorry for noobing you, been working with AS2 before, but this is my first assignment in AS3. A good way to learn something is by being pressured by deadlines
package
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    public class Puzzle extends Sprite
        private var xPos:int;
        private var yPos:int;
        private var correctCount:int = 0;
        public function Puzzle():void
            addListeners(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12);
        private function getPosition(target:Object):void
            xPos = target.x;
            yPos = target.y;
        private function dragObject(e:MouseEvent):void
            getPosition(e.target);
            e.target.startDrag(true);
        private function stopDragObject(e:MouseEvent):void
            if (e.target.hitTestObject(getChildByName(e.target.name + "Target")))
                e.target.x = getChildByName(e.target.name + "Target").x;
                e.target.y = getChildByName(e.target.name + "Target").y;
                //deactivate object
                e.currentTarget.removeEventListener(MouseEvent.MOUSE_DOWN, dragObject);
                e.currentTarget.removeEventListener(MouseEvent.MOUSE_DOWN, stopDragObject);
                //increment correct count
                correctCount++;
            else
                e.target.x = xPos;
                e.target.y = yPos;
            e.target.stopDrag();
        private function addListeners(... objects):void
            for (var i:int = 0; i < objects.length; i++)
                objects[i].addEventListener(MouseEvent.MOUSE_DOWN, dragObject);
                objects[i].addEventListener(MouseEvent.MOUSE_UP, stopDragObject);
p.s.: just so you know, it's a non profit thing, some games for my child's kindergarten - they are trying to introduce kids to PCs..

Similar Messages

  • Bug Report : Upgraded to Firefox v10. Holding CTRL+ [F4] too long after all tabs are closed causes error. "Exc in ev handl: TypeError: this.oPlg.onTabClosed is not a function"

    Bug Report :
    Upgraded to Firefox v10. Holding CTRL+ [F4] too long after all tabs are closed causes error.
    "Exc in ev handl: TypeError: this.oPlg.onTabClosed is not a function"

    What extensions do you have? (Go to Firefox > Customize > Add-ons to see or Help > Troubleshooting info for a copy-pasteable list)

  • All items are copied into Credit Memo request

    *Dear All*
    *Suppose I have created one scenario in which there is material code with one free goods and run uto the billing.*
    *I just need to know while creating Credit memo request wth reference to Billing,All items are copied into the sales order.My concern is that we can not hide free goods item in return order through Item selection.*
    Plz suggest on that issue

    Hi
    Yes you can set it up in the copy control of the item category so that it is not copied in the return order. But there is a specific reason why SAP would copy it into a return order. Suppose you sell goods and give something free, then based on the principle that the goods which were free were sent with the charged goods, it is expected that if the charged goods are sent back the free goods should also be returned.
    Thanks
    Indranil

  • Unable to cancel - open purchase order where all items are removed

    Hi all,
    When We try to cancel/close open purchase order where all items are removed from item master ?
    It showing error message,
    "No matching records found  'Items' (OITM) "
    Purcahse order was created on may-2007.
    As purchase order showing in open item list.
    Any solution for this problem ?
    Jeyakanthan

    SAP does allow items to be removed from the item master with open documents, but only if the documents have not created journals.
    It does create headaches though, and this situation is one of them.
    If there are not many items, I suggest you recreate the items, close the PO and just cancel the items rather than remove them.
    The other workaround is to change the items on the PO to something different that is in the item master, then close it.

  • Why does status bar say that all items are not loaded?

    When I have the status bar displayed at the bottom of my page, and I load a page, it usually says 4 of 5 item complete, or 6 of 7, or even one time, 92 of 93. What does this mean exactly? And why does it never say all items are completed? Is anything wrong with the browser, or is this just code for something?
    Thanks,
    Jeff

    These days web pages have many little extras, not just images, that have to be downloaded when we click on a link to a page. Sometimes, for a variety of reasons (file availability, internet problems, browser, bad coding, local cache, ISP problem) not everything downloads.
    As long as the page seems to have all the information and nothing is apparently missing, I tend to ignore this.
    When all items are completed, the status bar shows nothing.

  • How to reduce size of RAW & PSD files after all adjustments are finished?

    I thought I read something about an Aperture feature that reduces file size of RAW files to something like a large .jpg file. I have finished adjusting many RAW files and could better use the disc space for other things. Is there any such feature or procedure? I have not upgraded to Aperture 2.0 but will soon.
    Also, after making the round-trip to PhotoShop Elements, I see a large PSD file. Can I shrink that file after all adjustments are made?

    If you're using referenced files in Aperture, you can archive the raw files onto a CD or some other place and delete the original. Just make sure Aperture is set to generate previews before you do this. That way you can see the file even after it's gone. You can't export or make any adjustments unless you can re-link the raw file.
    And as far as PSD files, you should change your preferences to use TIFF for external editors. Then at least you can save the file in Photoshop as a compressed TIFF, which can save quite a bit of room. Also, I've noticed that Aperture uses 16-bit TIFF files, so you can save even more room by converting the file to an 8-bit TIFF.
    By the way, take note that while Aperture defaults to ".tiff" as it's file suffix for TIFF files, Photoshop prefers ".tif". This can cause confusion. You've been warned.

  • Still print picking list when ALL items are blocked. Is this possible.

    You know what warehouse people are like. When a delivery has all items blocked the picking list isn't printed, and the warehouse guys are wondering why nothing has printed. Of course a list is printed when there is at least one item that is not blocked on a picking list.
    My question is whether it's possible to print the picking list when all items are blocked?. I would expect no items to be printed for picking, but at the bottom of the report I would expect to see a list of items blocked.
    Anyone?.
    Jason

    HI
    1.Kindly chekc the routine in the t code V/27
    2.Against the routine against rthe condition type in the be.lwo path
          Logistics Execution
              Shipping
                 Output Control
                      Output Determination
                         Maintain Output Determination for Outbound Deliveries
                                Maintain Output Determination Procedure
    3.if it is in warehouse management then check in the tocde OMLV
    REgards
    Damu

  • All items are not visible even with no filter

    I have a custom list and am not able to run a search the list, through the "all items" view, even with no filter set.  The list is also set to only view 50 items at a time, but I am not able to view the next batch of items.  The search
    will give no results even when the list contains the item with that specific information.

    Hi,
    1) I understand you are not able to view the 'All Items' in the list.
    Can you check the total number of items that list contains.
    Go to Site Actions-->View All site content see the number of items beside the list name( right side)
    I suspect the list might be reached the threshold value.
    2) If the number of Items are less than the threshold value then I would suggest you do a  test by creating another view by providing only the view name (Don't use any sort, Filter, Groupby ...etc) and just keep the default settings and let me
    know if you are able to see the items using the newly created view.
    ****************************************************************************************** Please remember to mark your question as answered &Vote helpful, if this solves/helps your problem.
    s p kumar

  • Order Output should be supressed when all items are rejected

    We have a requirement, where when all schedule lines in a sales order are rejected the order confirmation output should be suppressed.
    This is what we did to achieve it.
    Using the customer modification structure KOMKBZ3, add a new field ZZ_ALL_SL_REJ . This field is an indicator that will be set if all all items in a sales order are rejected.
    Call function KOMKBV1_FILL to populate the communication structure KOMKBV1. The function calls USEREXIT_KOMKBV1_FILL, which is the header level user exit routine.
    In this user exit, through a select statement read table J_3AVBUE, and check for all schedule lines if 'ABSTA' equals C, if this is true the ZZ_ALL_SL_REJ  indicator is set to ‘X’.
    Then in the output requirement routine 900, see if KOMKBV1-ZZ_ALL_SL_REJ is set to 'X', if so set the return code to be 4.
    However when we reject items in sales order and save it, we have to go back in again and save it for the second time for the output determination to be carried out again.
    Could someone help with this...
    Thanks.
    Anne

    I believe an easier method would be to check KOMKBV1-ABSTK in the output requirement. If it's 'C', then all items have been rejected.
    Cheers, Paul.

  • Onload event after all images are loaded in an updateContent area

    Hi Spry Folks!
    I load a template into a page with a lot of img tags inside
    it. Everything works fine.
    Spry.Utils.updateContent (...HTML wit lots of img tags...)
    But the loading takes a while so I would like to hide it
    until all the images are loaded. Now I need an event which fires
    after the loading bar in the browser is gone.
    The onPostLoad observer fires much to early, cause the code
    is long loaded bevore all the images
    (...addObserver({onPostLoad:...)
    Same with the window.onload event (...window.onload =
    showContent();...) fires much to early.
    The only thing which is working is placeing the function in
    the onload event of the body tag.
    Like:
    <body onload="showContent();">
    But there I can't use it. And there is now body.onload
    handler as far as I know there is only the windows.onload handler
    and I thought always this is the same event than onload in the body
    tag.
    Has anyone an idea? Is there a spry event I haven't found for
    exact this problem?
    Thanks for your help!
    regrads
    marcus

    Hello,
    U might want to look in to the SpryImageLoader.js that comes
    with the 1.6.1 download. It loads your images, and allows u put
    callbacks on them, and set priority of loading them.
    http://www.dbooth.net/photos/
    uses it to (expect don forgot to upload the
    SpryImageLoader.js thats why its not really working :P )
    But that will give the basic idea of how to use it.
    Spry.Utils.ImageLoader.(url, callback(needs to be a function
    or null), priority)

  • How do I prevent Pages from changing earlier parts of a document when I am in an 8 page newsletter. Going back to check something and items are jumbled up!

    How can I stop Pages from changing parts of a document when I am progressing through an 8 page newsletter. When I go back to check something some headings have moved and been put out of context. I can't lock the individual pages of the document to prevent this happening.

    The Amazon iWork '09 is a DVD in a boxed set.
    Downloading is transferring something from the Internet.
    I think you are talking about not having a DVD drive?
    To install the DVD version, either get an external USB DVD drive, they are cheap on eBAy or borrow another computer and drag the iWork Installer onto a USB Flash Drive and install from that.
    Peter

  • How to check all items are not null in CAML Query?

    HI All,
    In a CAML Query, i got three items. In all three items, a particular column(Closure Date) should not be null. How to check in all three items, where 'Closure date' is not null?
    Thanks in advance!

    Hi,
    Try this:
    "<Where><IsNull><FieldRef Name='Closure Date' /></IsNull></Where>"
    Hope it hepls!
    Thanks,
    Avni Bhatt
    If this helped you resolve your issue, please mark it Answered

  • Moving a message to another file: not all files are listed by "MOVE": how do I get a local file shown on the left of the screen onto the move command list?

    I have some 20 "local" files, but when I want to copy or move a mailing only about half of these are listed as possible destinations. Why are some of then hidden and how can I get the full list to appear in the Move (or the Copy) window?

    I can't reproduce that here. I get a whole folder tree to explore.
    However, I prefer to use QuickFolderMove.
    It turns the '''right-click|Move To''' pop-out into a MRU list along with a text entry box so you seek a folder by entering all or part of its name. The beauty of this is that it doesn't care which folder or account the target folder is in. The downside is that you need to have a pretty clear idea of the name of the folder you're looking for.
    https://addons.mozilla.org/en-US/thunderbird/addon/quick-folder-move/?src=api

  • Text graphics are offset by one frame. Footage clips are in place but text graphics are off by one frame when output.

    Any thoughts?
    Mac os 10.9.5
    AE 2014 Latest
    Cleared Caches
    Restarted

    Here is a start. The program is used to make precise transitions and is not. Everything looks fine in the timeline previews, then get garbled by one frame when output.
    Thoughts?

  • FB05 All open items are not displayed

    Hi,
    We are trying to clear invoices on customer XXXX but it does not show all invoices in transaction FB05.
    We used all Special GL indicators and with normal items tab seperately as well as simultaneously but not all items are displayed What could be the problem.?
    regards,
    Makrand

    Hi
    You  can   first  analyze  the   open items in  FD10N  and  check  if  any  uncleard entries are present .   I   think that  even if  there is  a payment  block,  the  process item list  should  show  all  the  open items    as  seen in  FD10N.
    Thanks
    kamala

Maybe you are looking for

  • ITunes takes 20+ seconds to start playing!!!

    Just "upgraded" to 8.1 on my PowerBook G4 (10.4.11). I use iTunes to listen to radio talk shows I recorded. Now when I select one press play it takes forever for it start playing! I get the spinning colored wheel and have to wait and wait every time

  • Multi-Master replica busy

    I have a multi-master ldap server(5.1 service pack 2, build number:2003.028.2338). There are about 56k users in 1st server and 45k on the 2nd server when count the users in the 2 servers. Plus, I have a pure consumer which is working fine with the re

  • Modify a Table View Header

    I need to modify the header of a tableview and I've tried this: .table-view {     -fx-background-color: rgb(70,70,70);     -fx-text-fill: white;     -fx-border-style: solid;     -fx-border-color: transparent; /*    -fx-border-insets: 0 1 1 0, 0 0 0 0

  • Can i retrieve lost pictures with metadata backup?

    A few months ago I "cleaned up" iPhoto so I could use it solely for my portfolio of work. My personal pics I saved to my external HDD [Western Digital MyBook] and removed them from my Mac's hdd. I recently discovered that pics I thought were saved to

  • How to use tab to link to other page in other application

    Hi all, I noticed that tabs does not have the option URL for the Target. It only has current page. Is it possible to link a tab to a page in another application in the same workspace? Thanks. Allen