ActionScript 3.0 - when all items are drop, switch to the next scene.

I want to drag and drop to some coordinates.

I have two blocks of mobile homes, where player can drag any block in initially to support 1. Then drag another block for the second time on support 2.

When block does not strike has 1 or 2, it will take end and this block to the original mark.

When the hit two two details of the holder, then move to the next scene.

import flash.events.Event;

Stop (); stop the scene

var startingPt:Point = new Point (). variable declaration

var movingBlock:Sprite;

set var: int = 0; initialize

var blok1:Boolean = false;

var blok2:Boolean = false;

point var endpoint: Boolean = false;

Block3.addEventListener (MouseEvent.MOUSE_DOWN, startBlockMove); function

Block2.addEventListener (MouseEvent.MOUSE_DOWN, startBlockMove);

function startBlockMove(evt:MouseEvent):void {//the object moving

movingBlock = Sprite (evt.currentTarget);

startingPt.x = movingBlock.x;

startingPt.y = movingBlock.y;

stage.addEventListener (MouseEvent.MOUSE_MOVE, moveBlock);

}

function moveBlock(e:MouseEvent):void {call //object based on the mouse coordinates

movingBlock.x = stage.mouseX;

movingBlock.y = stage.mouseY;

}

stage.addEventListener (MouseEvent.MOUSE_UP, stopMotion); stop moving

function stopMotion(evt:MouseEvent):void {}

stage.removeEventListener (MouseEvent.MOUSE_MOVE, moveBlock);

snapInPlace();

movingBlock = new Sprite();

startingPt = new focus();

}

function snapInPlace (): void {/ /}

If (blok1 == false | blok2 == false) {}

If (holder.hitTestObject (movingBlock)) {//object1 hit the goal

movingBlock.x = holder.x;

movingBlock.y = holder.y;

place ++;

movingBlock.removeEventListener (MouseEvent.MOUSE_DOWN, startBlockMove);

blok1 = true;

}

ElseIf (holder1.hitTestObject (movingBlock)) {//object2 hit the goal

movingBlock.x = holder1.x;

movingBlock.y = holder1.y;

movingBlock.removeEventListener (MouseEvent.MOUSE_DOWN, startBlockMove);

blok2 = true;

}

else {}

movingBlock.x = startingPt.x;//if does not hit the goal, the return of original coordinates

movingBlock.y = startingPt.y;

blok1 = false;

blok2 = false;

}

}

Else if (blok1 == true & & blok2 == true) {}

setTimeout (function () {endpoint = true;)

trace ("You died!");

removeEventListener (Event.REMOVED, snapInPlace);

(Stop (1, "scene 2");}, 1000);

}

}

The output gives the error,

TypeError: Error #2007: hitTestObject parameter must be null.

at flash.display::DisplayObject/_hitTest()

at flash.display::DisplayObject/hitTestObject()

at Untitled_2_fla::MainTimeline/snapInPlace() [Untitled_2_fla. MainTimeline::frame2:38]

at Untitled_2_fla::MainTimeline/stopMotion() [Untitled_2_fla. MainTimeline::frame2:31]

Where to frame2:38

If (holder.hitTestObject (movingBlock)) {}

and frame2:31

snapInPlace();

How to solve this problem?

Use this code:

var startingPt:Point = new focus();

set var: int = 0;

Block2.buttonMode = block3.buttonMode = true;

Block2.addEventListener (MouseEvent.MOUSE_DOWN, startBlockMove);

Block3.addEventListener (MouseEvent.MOUSE_DOWN, startBlockMove);

Block2.addEventListener (MouseEvent.MOUSE_UP, stopBlockMove);

Block3.addEventListener (MouseEvent.MOUSE_UP, stopBlockMove);

function startBlockMove(evt:MouseEvent):void

{

startingPt.x = evt.target.x;

startingPt.y = evt.target.y;

evt.target.startDrag ();

}

function stopBlockMove(evt:MouseEvent):void

{

evt.target.stopDrag ();

If (evt.target == block2 & evt.target.hitTestObject (holder1))

{

evt. Target.x = holder1.x

evt. Target.y = holder1.y

evt.target.removeEventListener (MouseEvent.MOUSE_DOWN, startBlockMove);

place += 1;

}

ElseIf (evt.target == block3 & evt.target.hitTestObject (holder2))

{

evt. Target.x = holder2.x

evt. Target.y = holder2.y

evt.target.removeEventListener (MouseEvent.MOUSE_DOWN, startBlockMove);

place += 1;

}

on the other

{

evt. Target.x = startingPt.x

evt. Target.y = startingPt.y

}

////

if(placed == 2)

{

Stop (1, "scene 2");

}

}

Tags: Adobe Animate

Similar Questions

  • Firefox ends when all tabs are closed in V36

    In V35, Firefox continues to work even if all the tabs are closed.
    Now in V36, Firefox ends when all tabs are closed.
    Y at - it a configuration back to the original schema option used in V35?

    1. Type "subject: config ' in got and then press on enter
    2. Type "lasttab" in the filter
    3. find the entry "browser.tabs.closeWindowWithLastTab", right-click to toggle its value to 'false '.
  • How I use a proxy? When all ports are closed. Even Skype has now closed! Like any.

    Hello

    How I use a proxy? When all ports are closed. Even Skype has now closed!

    Like any.

    Unknown Windows & Auto cant detected no connections, the proxy & the so... as; (P or vpn, sucks4 & 5 servers, https)

    I need "full technical assistance" and get expert advice... Because:
    I want to check my emails...!

    But I can't open Skype Support web Page & ~ all networks.

    CONCERNING

    Hello

    Thanks for posting your query in the Microsoft Community Forums.

    According to the description of the problem, it seems that you want to use the proxy to access email and Skype.

    I will certainly help you with this issue.

    I suggest you to refer to the links and check if it helps.

    Change the proxy server settings in Internet Explorer 

    Note: In some corporate environments, network or proxy settings might be solved or disabled by the administrator.

    Can I connect to Skype via a proxy server?

    If the problem persists or you have any other questions about Proxy servers, do not hesitate to let us know. We will be happy to help you.

  • The August 2012 calendar items are not available in the calendar of the modern user interface application

    The August 2012 calendar items are not available in the calendar of the modern user interface application.  They are available through a web browser and the application MS Office Outlook.  Y at - it a setting or another way to access old calendar items in the modern user interface.  The phone application has the same problem.

    Original title: elements of August 2012 calendar

    Hello

    I suggest for the link and run the troubleshooting utility Apps and follow the other steps in the article:

    What to do if you have problems with a soft

    http://Windows.Microsoft.com/en-in/Windows-8/what-troubleshoot-problems-app

    See also:

    Application of calendar for Windows: FAQ

    http://Windows.Microsoft.com/en-in/Windows-8/calendar-FAQ

    Stay in touch with email and calendar

    http://Windows.Microsoft.com/en-us/Windows-8/mail-calendar#1TC=T1

    I hope this helps. If you have any other queries/issues related to Windows, write us and we will be happy to help you further.

  • This may seem like a strange question, but im trying to encode two buttons Flash Adobe, next and previous, however, when I put the thumb to the next scene and play on the next button and the previous scene and play on the previous button, it keeps switchi

    This may seem like a strange question, but im trying to encode two buttons Flash Adobe, next and previous, however, when I put the thumb to the next scene and play on the next button and the previous scene and play on the previous button, it keeps switching autour.

    If you have symbols of button on the stage to the next and previous, each of these symbols has an instance name with a listener event attached to it. The event listener is linked to a mandate. You can have a single event point to a function. So for example, if you have a next button and a click event that points to a function that says something like nextFrame(); and then you want to use the next button to point to a function that says something like nextScene(); you will need to use another instance of this next button and have this different instance to use a different event handler to point to a different function. Who help me?

  • How to reset all items on a page on the page change?

    Hi all!

    I'm trying to reset all items whenever a user edits a page. Then when they are on page 17, they can calculate the food values, and these values get inserted into page elements.
    Now, I want to be able to reset all these objects on page 17, when a user goes to one page other than 17.

    I did a page process, on the laundry after the header, visit runs once per page.
    The code is like this:
    if :APP_PAGE_ID <> 17 then
    :p17_set_unit := null;
    :p17_set_language := null;
    :p17_set_weight := null;
    :p17_new_weight := null;
    :p17_new_kcal := null;
    :P17_new_carbs := null;
    :p17_new_protein := null;
    :P17_new_fat := null;
    :p17_foodname := null;
    :p17_select_foodname := null;
    :p17_foodid := null;
    end if;
    So basically, if the current page is not 17, then it should reset all values. Why does this work?
    I made other processes that do the same (as when you change the language of food, all items except the point of language GET reset), but it does not work.
    What I am doing wrong? Or should I fix this on a different path?

    Thanks in advance.


    APEX version: 4.1.1.00.23

    Hello, Magali,.

    Oops! I missed it. We do not have the process on page 0!

    You can create a Process of Application which runs in charge of pages and clears the cache for the page 17 using APEX_UTIL. CLEAR_PAGE_CACHE. Use the above condition.

    Reference:

    http://docs.Oracle.com/CD/E23903_01/doc/doc.41/e21676/apex_util.htm#BABCIAFJ

    I hope that helps!
    Kind regards
    Kiran

  • How do I know when all users leave a room using the server to Server API

    What should I subscribe to with the API server to server to receive a reminder when there is no user in a room, or when all users have left a coin. On the client, I am able to look connectSession.userManager.userCollection, but is it possible to subscribe to this side Server? Also, could you tell me the name of the node/collectionNode I should be signing up too?

    Hello

    Server-side, we have by default all codes that tell you whether all users have left. You have to build this logic in your server on your own code. You must first subscribe to the collection 'UserManager' as 'UserManager' is the name of the node collection UserManager.

    Once you do this, you will get always any article that appeared on this collection in your "receiveItem" hook function

    Now, whenever you get a point on the node called "UserList" to the title of this collection, it designates a user input or output or userDescriptor of some user has been changed.

    So from any element on UserList, you can build an accounting from the list of users on your code on the server side and every time you download an item, you can check if your bookkeeping list is empty or not, and if so, there is no user in this room.

    Do the same on the client side too (you can refer to the onItemReceive function in UserManager.as).

    Hope this fixes your problem

    Thank you

    Hironmay Basu

  • Cannot get my menu buttons drop down to post a link to the next scene.

    I can't get my menu buttons drop down to connect other scenes in the same Flash file.  The buttons are unresponsive during playback - as if no code was attached to him.  Here is what I have as my AS2 code on abandonment button which is supposed to link to the "Published" scene / page:

    {We (Release)}

    _root.gotoAndPlay ("published", 1);

    }

    I work with Actionscript 2.0 in Flash CS6.

    Any help would be appreciated!

    Thank you

    Robert

    You can use different scenes.

    but don't use scene for navigation information (in your actionscript code).

    for example, if you want to use a goto in the 18th frame of stage 5, label which frame (for example, "frame18_scene5") and use:

    _root.gotoAndPlay ('frame18_scene5');

  • ALL IN ONE C3180 - ERROR "FAILS THE NEXT CARTRIDGE: 3 COLORS.

    HELLO AND I HOPE YOU ANSWER ME. I HAVE THIS PROBLEM FOR LIKE a YEAR, I BOUGHT a PRINTER ALL IN ONE C3180 3 YEARS ago AND all of a SUDDEN WHEN I TRIED to PRINT a MESSAGE SURGIT IN SAYING ' THE NEXT FAILED of CARTRIDGE: 3 COLORS ' THE PROBLEM IS that HE OWNED a COLOR CARTRIDGE inside AND he WAS NEW AND ORIGINAL. I THOUGHT MAYBE IT WAS EMPTY, I BOUGHT A NEW ONE AND A PLACE. BUT I LOST MY MONEY BUY A NEW ONE, AND WHEN I PUT IT, I HAD THE SAME PROBLEM. THE INK IS FLASHING. AND I CAN'T PRINT IN BLACK OR BECAUSE IT IS SAID THAT HE BOTH CARTRIDGES ON. ANY IDEA? BECAUSE, I HAVE REINSTALLED THE DRIVER, AND NOTHING HAPPENED. I BOUGHT 2 MORE BECAUSE I THOUGHT HAS A PROBLEM OF INK, BUT NOTHING HAPPENED. I CAN'T USE IT AT ALL AND I HAVE BLACK AND FULL COLOR CARTRIDGES. Thank you.

    I HAVE WINDOWS XP BUT I TRIED WITH VISTA ALSO AND NOTHING happened.

    I called HP because I was really frustrated and tired and have no guarantee. I was told that this isn´t a cartridge problem, it is a technical problem of the printer itself. they have a sensor to detect each cartridge and that the sensor has failed. So I need to replace the part or just buy a new.

    hope this information helps someone else.

  • mp3 music: songs when a track is more does not automatically switch to the next

    When I listen to my music, skip to the next track a mp3 of the album not happen automatically, but I have to press (song after song) the progress of the arrow... How can you solve?
    Thank you

    Paolo

    p. s.

    Sorry for my English, but I rely on a translator because I don't know

    no news for the moment... Wait for a new firmware.

    by

    Paolo

  • Hide a Page when all fields are empty.

    Hello world

    I am currently using LiveCycle Designer ES 8.1, I must also point out that I am new in this field of Adobe.

    I need your help. I want to check if all the fields are empty, if so I want to hide this specific page, using JavaScript.

    Please note that all my fields are read-only. These fields will be filled using XML data.

    There are commands that will give you all the objects on a particular page... then you can scroll them (one at a time) to see if they are populated. I think you might encounter problems when you try to hide the page you are currently... .He would be an interesting exercise, however. If you send the data and form file to [email protected] I will give it a go when I had the chance.

    Paul

  • WMP11 loses data when extracting. All files are track 0 and the length of the song is not listed.

    Using Win XP Pro & Media Player 11. Works very well for a long time. Recently, I have problems during extraction.

    Album info & track is correct, and he rips it in the right folder (with the names of artist & album as folder names). But the WMP11 database is messed up. The names of the files/tracks are OK, but all the songs are track 0, and all other data such as the name of the album, genre, year and artist are all unknowns. WMP11 does not know the length of the songs.  I can change the data, but not the length.  How can I fix it?

    Hello RHarrigill,

    Thank you for your message.  It is possible that Windows Media Player 11 database must be damaged.  Please follow the steps below:
    Exit Windows Media Player.
    Click Start, run, type %userprofile%\Local Settings\Application Data\Microsoft\Media Player, and then click OK.
    Note Windows Media Player automatically rebuilds the database.
    If this does not resolve the problem, disable the Windows Media Player database cache files. To do this, follow these steps:
    If you are running Windows XP, click Start, click Run, type %userprofile%\Local Settings\Application Data\Microsoft and then click OK.
    Restart Windows Media Player.
    Note Windows Media Player automatically rebuilds the database.
    Please let us know if it did or did not solve your problem.
    See you soon

    Engineer Jason Microsoft Support answers visit our Microsoft answers feedback Forum and let us know what you think.

  • Photoshop CS2 hogs RAM even when all documents are closed.

    As the title says.  I was able to recreate the issue in this video: (never mind, I guess I can't post links)

    Long story short; After having the documents open, I have to close Photoshop and reopen it to recover my RAM.

    Why does this happen?

    Thanks in advance!

    You don't even have to close Photoshop. If it's not actively use RAM, it will come out there.

    That's what the people who need to know.

  • Where the catalogues items are really stored on the PC?

    Where items catalogs?

    So I installed Elements 9.  I noticed that he always displays information from the catalog when I has elements 8 on my machine.  Where are these catalogues?

    Before you say so... When I deleted the 'Catalog' folder under docs and settings > user > adobe > elements Organizer

    They always show!

    My concern is that there are still items in them, by the organizers convert button.  I don't know what these are the photos, and although I don't think I've lost one of them, I don't like random objects floating around.

    Elements Organizer 9

    Default location of catalog

    • Mac OS
      Current user: /Users/name your nameof user/Library/Application Support / Adobe / elementsOrganizer/catalogs/Catalog name
    • Windows 7 and Vista
      All users: C:\ProgramData\Adobe\Elements Organizer\Catalogs\name of the catalog
      Current user:your username\AppData\Roaming\Adobe\Elements Organizer\Catalogs\catalog name C:\Users\
    • Windows XP
      All users: C:\Documents and Settings\All Users\Application Data\Adobe\Elements Organizer\Catalogs\catalog name
      Current user: C:\Documents and Settings\username\Application Data\Adobe\Elements Organizer\Catalogs\catalog name

    Source:

    http://kb2.Adobe.com/CPS/859/cpsid_85996.html

  • All Photos are gray / blurry except the one selected

    Screen Shot 2015-06-03 at 16.39.44.png

    Dear experts

    For some or other reason my wife fiddled with my LR6 after she imported the photos it has scanned.

    Now my thumb nails looks like the screenshot above.

    All the photos are blurry or dull, but when I click on they they go back to the original bright colors

    Please how to fix this.  I looked on this and other forums, but I can only see topics related to monitors.  I also find it hard to Word my question to find an answer.

    Thanks in advance

    PS

    She is now banned from LR and must now work in PS Elements

    Hi convert them LR4.

    Looks like pictures all put the flag to reject, and your grid view options are not configured to display flags for me. This could happen if all images have been selected and you press the "X" (X = 'mark') as rejected.

    Look in view > View Options > view grid and select Show grid Extras.  Make sure that the cell icons area has 'Flags' selected.

    You see a black flag with an "X"?

    To remove rejection indicator, select all (Ctrl-A or command-A) and press the 'U' (U = "Unflag").

    I hope this helps!

    MIke

Maybe you are looking for