Game Not Scrolling

     So i've finished learning how to scroll and the book has challenged me to try parallax scrolling and to figure it out on my own. So i've tried to apply my previous scrolling knowledge (as little as it may be) at gave it an honest attempt. The problem is when I test it the player (named after my cat Vivace!) the player doesn't move. I'm also getting the following warnings.
"warning:1090: Migration issue: The onKeyDown event handler is not triggered automatically..."
and
"warning:1090: Migration issue: The onKeyDown event handler is not triggered automatically..."
The code is as follows:
package
          import flash.display.MovieClip;
          import flash.events.KeyboardEvent;
          import flash.ui.Keyboard;
          import flash.events.Event;
          public class Main extends MovieClip
                    var vx;
                    var hvx;
                    var rightInnerBoundary:uint;
                    var leftInnerBoundary:uint;
                    var housePage:HousePage;
                    public function Main();
                              init();
                    function init():void
                              //initilize Variables
                              vx = 0;
                              hvx = 0;
                              rightInnerBoundary = (stage.stageWidth / 2) + (stage.stageWidth / 4);
                              leftInnerBoundary = (stage.stageWidth / 2) - (stage.stageWidth / 4);
                              addChild(housePage);
                              //add Event Listeners
                              stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
                              stage.addEventListener(KeyboardEvent.KEY_UP, onKeyUp);
                              addEventListener(Event.ENTER_FRAME, onEnterFrame);
                    function onKeyDown(event:KeyboardEvent):void
                              if (event.keyCode == Keyboard.LEFT)
                                        vx = -5;
                                        hvx = -2.5;
                              else if (event.keyCode == Keyboard.RIGHT)
                                        vx = 5;
                                        hvx = 2.5;
                    function onKeyUp(event:KeyboardEvent):void
                              if (event.keyCode == Keyboard.LEFT || event.keyCode == Keyboard.RIGHT)
                                        vx = 0;
                                        hvx = 0;
                    function onEnterFrame(event:Event):void
                              //initialize local variables
                              var vivaceHalfWidth:uint = vivace.width / 2;
                              var backgroundHalfWidth:uint = background.width / 2;
                              //scroll player
                              vivace.x = vx;
                              //stop player at inner boundaries
                              if (vivace.x - vivaceHalfWidth < leftInnerBoundary)
                                        vivace.x = vivaceHalfWidth + leftInnerBoundary;
                                        rightInnerBoundary = (stage.stageWidth / 2) + (stage.stageWidth / 4);
                                        background.x -= vx;
                                        front.x -= vx;
                                        clouds.x -= hvx;
                              else if (vivace.x + vivaceHalfWidth > rightInnerBoundary)
                                        vivace.x = vivaceHalfWidth - rightInnerBoundary;
                                        leftInnerBoundary = (stage.stageWidth / 2) + (stage.stageWidth / 4);
                                        background.x -= vx;
                                        front.x -= vx;
                                        clouds.x -= hvx;
                              //stop background at stage edges
                              if (background.x + backgroundHalfWidth < stage.stageWidth)
                                        background.x = stage.stageWidth - backgroundHalfWidth;
                                        front.x = stage.stageWidth - backgroundHalfWidth;
                                        clouds.x = stage.stageWidth - backgroundHalfWidth;
                                        rightInnerBoundary = stage.stageWidth
                              else if (background.x - backgroundHalfWidth > 0)
                                        background.x = 0 + backgroundHalfWidth;
                                        front.x = 0 + backgroundHalfWidth;
                                        clouds.x = 0 + backgroundHalfWidth
                                        leftInnerBoundary = 0;

onKeyDown is a reserved term in as2. Thus the compiler seems irritated (Migration issue).
rename your Handlers into something more as3-like (keyDownHandler...)

Similar Messages

  • Using safari 5.1.2 on a pc and mouse does not scroll any window

    Hi, I just installed Safari on a PC version 5.1.2 and so far I prefer it over all the other browsers out there except for one major issue: any window I open will not scroll down or up with the mouse wheel. I have to drag the window bar up or down and its very annoying. Any Ideas?

    mouse works fine on all other browsers ( IE, FF, Chrome) and inside windows and all games. but not in safari. i have to use the scroll bar on the far right side.
    i was reading other posts and saw something called iFrames. do i need to installl iFrames maybe?

  • My ipod touch will  not scroll down in the voice mode so i can turn it off and go back to just touching it

    my Ipod touch will not scroll down in the touch voice mode to cut it off

    See this article for information on how to disable VoiceOver.
    http://support.apple.com/kb/ht3577
    B-rock

  • Mail does not scroll while in full screen!

    When on full screen mail just ignores the fact that there's more stuff (text, pics...) in the email and does not scroll down. No bar on the side, no scrolling with arrows, touchpad or space bar is working. When I bring it back to a smaller size or just open the email in a sparate screen it works OK.
    Not a huge issue, but an irritating one, wonder if this is happening to anyone else? and if anyone has a good fix to it?
    Thanks

    the release notes say it has issues in non-interactive mode,
    I'm using doing :
    stage.displayState =
    StageDisplayState.FULL_SCREEN_INTERACTIVE;
    Is there maybe something else I need to set to full screen
    interactive? I know I saw somewhere that the person was setting the
    htmlLoader's stage to full screen interactive. I tried that but it
    did nothing.
    I have the window style set to "system chrome". I tried
    transparent and no flash sites worked(full or normal screen) and
    opaque worked the same as system chrome.

  • I had a translator app.i presses the voice buuton now it wont switch of and is saying everything. The scree will not scroll now. I have deleted this app on my lap top via iTurnes. I have synced my phone. I have taken the sim out I have turned it off and o

    anyone help please my phone woint stop telling me everything sice pressing a button for voice on a translator app. the screen will not scroll. I have sync the phone deleted the app on the lap top but it wont let me delete it on the screen because its frozen. I have taken out the sim card.. I have turned it off now Im stuck.. Im in a small village in Spain and cannot get to an Appke store to get it fixed yet. Any ideas?

    Plug your phone into the wall charger for at least 30 minutes...make sure you have a sim card in the phone...then:
    Leave the USB cable connected to your computer, but NOT your phone, iTunes running, press & hold the home button while connecting the USB cable to your dock connector, continue holding the home button until you see “Connect to iTunes” on the screen. You may now release the home button. iTunes should now display that it has detected your phone in recovery mode, if not quit and reopen iTunes. If you still don’t see the recovery message repeat these steps again. iTunes will give you the option to restore from a backup or set up as new.
    Make sure you have no anti-virus software running or any firewalls...turn all of that stuff off.

  • I can not scroll on my dell studio touchpad and I am running Windows 7 and Firefox 8.0.1.

    I just noticed that I can no longer use my touchpad to scroll on webpages in Firefox 8.0.1. I don't think I had this problem a few days ago, definitely not last week. I see the scroll icon but it does not scroll when I am on any webpage. At times it starts on one page until i refresh the page or click a link on the page but then it will stop scrolling.
    I am able to scroll using my touchpad in Word 2010 and on the rest of my computer.
    I am running Windows 7 Home Premium 64-bit and have a Dell Studio 1558 that is a year old.
    I updated the touchpad driver from and it still did not work. Then tried the one directly from Synaptics and still not working.
    I also updated Firefox 8 to 8.0.1 and it still does not work.
    Please fix this as it is rather annoying.

    My scroll also doesn't work in Firefox -- but does in Excel and Word. This has been intermittent for months now. Usually, if I reboot the scroll would begin working again until for no apparent reason it quits again. Now even the reboot doesn't fix the no-scroll problem. I have Windows Vista. I even did a Firefox Update to 9.0.1.
    I don't have that file on my about:config page so this solution won't work for me.
    Thanks in advance for any help!

  • I have a Macbook Pro and have just purchased a GSP hidden objects game. It says on the box that it is compatible and when I try and install it it tells me that installation has been successful. However, it then says that PowerPC games not supported. Help?

    I have a Macbook Pro and have just purchased a GSP hidden objects game. It says on the box that it is compatible and when I try and install it it tells me that installation has been successful. However, it then says that PowerPC games not supported. Help?
    No game icon appears on my desktop and I don't know what I can do.
    Really ****** off as i've not played these games since switching from a windows PC to a Mac and was really excited!! All I want is to be able to play my new game that arrived in the post today. If anyone can help I would be really really grateful....
    The game says that it needs Mac OS X 10.3 or higher to run so I don't understand what the problem is or how I can fix it!!

    beckyj3,
    the last version of Mac OS X which supported running PowerPC apps on Intel Macs was Mac OS X 10.6.8 (Snow Leopard). If you’d like to play this PowerPC game on your Intel MacBook Pro, then you’ll need to install Snow Leopard on it and boot into Snow Leopard. (Note that the last MacBook Pro which natively supported Snow Leopard was the Early 2011 model.)
    The game was almost certainly published before Mac OS X 10.7 (Lion) was released, so back then, all versions of “Mac OS X 10.3 or higher” would have supported running that PowerPC game.

  • Pages created with DWT will not scroll

    I recently acquired a contract to update a site built in CS2 with tables to something that's HTML 4.01 compliant. I'm using CS5 and have updated the DWT's design, but now my pages will not scroll using the new template. I've tried using the overflow tag in several ways and locations within the DWT and style sheet itself, but to no avail. I have also created new pages from this template and they won't scroll either. I'm clearly missing something, does anyone have any ideas as to what that is? Does anyone need snippets of code?
    Thanks, Kevin

    elvikingoproductions wrote:
    I recently acquired a contract to update a site built in CS2 with tables to something that's HTML 4.01 compliant. I'm using CS5 and have updated the DWT's design, but now my pages will not scroll using the new template. I've tried using the overflow tag in several ways and locations within the DWT and style sheet itself, but to no avail. I have also created new pages from this template and they won't scroll either. I'm clearly missing something, does anyone have any ideas as to what that is? Does anyone need snippets of code?
    Thanks, Kevin
    Why are tables not HTML 4.01 compliant?
    Regardless, you have to post a link to the page in question or provide the code (both HTML & CSS) for examination.  The typical link you will be pointed to is the validator, so you may want to clean up as much as you can before you provide the link.
    http://validator.w3.org/

  • JScrollPane not scrolling to the end of JTable

    Hello,
    I put a table in a scroll pane, and add the scroll pane to a panel. The problem is the scroll pane does not scroll to the end of the table, it always lets me view only the first 37 rows of the table, regardless of how many rows the table actually has. Basically, the scroll pane thinks the table has exactly the same height, no matter how many lines it has. Why is this happening?
    The code is something like
    model = new SearchResultTableModel(false, null, null);
    table = new ResultTable(model);
    scrollPane = new JScrollPane(table);
    mainBox.add(scrollPane);
    If this is important, the table is a bit more complicated, I subclass JTable, use a custom TableModel, several types of cell renderers / editors, so maybe this is why it behaves so strange. How could I tell the scroll pane the table is actually larger?
    Thank you very much, any ideas are highly appreciated,
    Regards from Romania,
    Adi

    Hi,
    fireTableDataChanged() is the easiest way to do it, but also that one, that forces JTable to rerender all visible cells, regardless the fact, that they are already displayed and would not need rerendering - if you add a row - for example row 7 - do fireTableRowsInserted(7,7); instead - so JTable will only render this single row if it is visible in the viewport. If you add a couple of rows, for example row 7 to 227, do fireTableRowsInserted(7,227); - always fire only the correct notifications accordingly to the changes you make, in order to keep the performance of JTable high.
    greetings Marsian

  • I have a Mac running 10.9.2. My wireless mouse with not scroll in mail but works fine in other applications? Any suggestions?

    I have a Mac running 10.9.2. My apple wireless mouse will not scroll in Mail but works fine in other applications.
    Any suggestions?

    First, see this discussion. If the solution suggested there doesn't work for you, continue.
    If you've installed a Mail plugin called "Mail Unread Menu" and you know how to remove it, please do that, then quit and relaunch Mail. Test. Otherwise, see below.
    Back up all data.
    1. Triple-click anywhere in the line below on this page to select it:  
    ~/Library/Mail/Bundles
    Right-click or control-click the highlighted line and select 
    Services ▹ Open
    from the contextual menu.* A folder may open, or you may get an error message that the item can't be found. Either result is normal. If the folder does open and has contents, move the contents to the Desktop. Relaunch Mail and test. If there's no change, put the contents of the folder back and quit Mail again.
    2. Repeat with this line:
    /Library/Mail/Bundles
    This time you may be prompted for your login password when you remove the items. Make sure they're removed from the folder and not just copied to the Desktop. If necessary, copy them first and then move the originals to the Trash.
    *If you don't see the contextual menu item, copy the selected text to the Clipboard by pressing the key combination  command-C. In the Finder, select
    Go ▹ Go to Folder...
    from the menu bar and paste into the box that opens (command-V). You won't see what you pasted because a line break is included. Press return.

  • Has anyone had an issue with FindText not scrolling in Acrobat X?

    I wrote some code for Acrobat 8 using C# that used AcroAVDoc 's FindText method to search for a particular phrase so that I may find the page the text it was on and its location on the page so that I can insert an image at that location.  This worked great, the FindText method returned true when it found the text, scrolled to the page it was on and selected  the text.  In Acrobat X, I can not reproduce this.  It finds the text but does not scroll or select.
    Has anyone had this issue?  If so, how did you resolve it?
    Below is the code snippet that worked in Acrobat 8:
      try
                    Acrobat.CAcroApp app = new AcroApp();
                    Acrobat.CAcroAVDoc doc = new AcroAVDoc();
                    object jso;
                    app.Show();
                    //Open  For Searching
                    if (doc.Open(PdfDocument, ""))
                        Thread.Sleep(AcrobatDelay); //WaitForAcrobatToLoad
                        bool found = doc.FindText(SearchTerm, 0, 0, 0);
                        if (found)
                            CAcroAVPageView pv = doc.GetAVPageView();
                            int PageNum = pv.GetPageNum();
                            CAcroPDDoc pdDoc = (CAcroPDDoc)doc.GetPDDoc();
                            jso = pdDoc.GetJSObject();
    Thanks in advance for any help.

    Hi,
    I just found these work arounds.
    https://discussions.apple.com/thread/5490015?tstart=0
    The first is appropriate if you want to send as an undlisclosed resicpient. The second method shows all addresses.

  • IPhone Simulator will not scroll

    I've the latest Xcode, Mac OSX, and Safari. When I use the iPhone Simulator to test a Drupal website I've developed the simulator will not scroll any of the pages. I'm using a MacAir with no mouse. What do I have to do to scroll?

    I suspect you have the Voiceover accessibility feature turned on. The easiest fix is to connect your phone to iTunes. Select the "Configure Universal Access" button in the summary pane and turn Voiceover off.

  • Window will not scroll down in Design mode in DW CC 2014

    On a Wacom Companion running DW 2014.1.1, build 6981 Windows 8.0, opening a page, it will not scroll down in Design unless I click Split, then it will scroll some more and stop. Have to click modes back and forth to get to bottom of the screen. No issue viewing the page in a browser. Have 8 Tabs (pages) open, and other programs. Sys shows CPU/MEM at 38/84. Win 8.1 is installed, just need to reboot to activate upgrade.

    See this article for information on how to disable VoiceOver.
    http://support.apple.com/kb/ht3577
    B-rock

  • Trackpad will not scroll imac

    I bought a new iMac last year and was busy so I didn't use it much. Along with a trackpad and a wireless mouse. The mouse works as expected however the trackpad will not scroll a Safari Window.
    It will scroll when connected to my 5 year old Macbook. I took the trackpad to an Apple store and it worked fine on the geniuses laptop there.
    It just doesn't scroll a windwo on my iMac. I have experimented with the settings endlessly but it just doesn't scroll. I tried calling tech support and they said take it to the apple store which I did. I just now noticed that in a safari window the slide bar disappears when I use the trackpad. but reappears wheh I use the mouse.
    I  hope I don't have to lug the entire computer back to the Apple store. It seems like a software issue to me. Any suggestions welcomed here.

    how do you try to scroll ?
    some people are used to trackpads scrolling when they move their finger out in the right side or the likes
    with newer macs one scroll by placing 2 fingers beside eachother and moving them up and down

  • Just installed Safari on PC.  MS wireless mouse will not scroll on most pages; will scroll on history section of homepage.  Any explanation?

    Just installed Safari on Sony PC.  MS wireless mouse will not scroll on most pages.  But will on "History" section of homepage.  Help appreciated.

    Panic over. I tunes now appears to be working normally.

Maybe you are looking for