Hidden objects

being new to actionscript3 I thought I would create a simple little game involving a skydiver who is supposed to be falling towards the ground, the problem I have got is the scrolling background is hidding the birds, planes and clouds objects which scroll up, this problem is driving me mad, can any of the more experienced programmers help before i go completelly mad trying to solve this annoying problem.
package
    import flash.display.MovieClip;
                import flash.text.*;
                import flash.events.Event;
                import flash.events.KeyboardEvent;
                import flash.ui.Keyboard;
                import flash.display.Stage; 
                import flash.utils.Timer; 
                import flash.events.TimerEvent;
                import flash.utils.getDefinitionByName;
    public class game_code extends MovieClip {
         public  var sky_Diver:sky_diver;
         public var leftArrow:Boolean = false;
         public var rightArrow:Boolean = false;
         public var BackGround:clouds;
         public var BackGround2:clouds;
         public var BackGroundBreadth:Number;
         public var BackGroundContainer:MovieClip;
                     public var scrollSpeed:uint = 1;
                                 var score:int = 0;
                                 public var nextObject:Timer;
                                 public var objects:Array = new Array();
                                 const speed: Number = 9.0;
        public function game_code(){
            sky_Diver = new sky_diver();
                                                BackGround = new clouds();
                                                  BackGround2 = new clouds();
                                                sky_Diver.x = 200;
                                                sky_Diver.y = 200;
                                                BackGround.y = BackGround.height;
                                                 BackGround2.y = 0;
                                                 BackGround.x = 400;
                                                BackGround2.x = 400;
                                                BackGround.scaleY = 1;
                                                BackGround2.scaleY = 1;
                                                BackGroundContainer = new MovieClip();
                                                 BackGroundContainer.addChild( BackGround );
                                                 BackGroundContainer.addChild( BackGround2 );
                                               stage.addChild(BackGroundContainer);
                                                stage.addChild(BackGround);
                                                stage.addChild(sky_Diver);
                                               setNextObject();
                                                stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressedDown);
                                                stage.addEventListener(KeyboardEvent.KEY_UP, keyPressedUp);
                                                stage.addEventListener(Event.ENTER_FRAME, movesky_Diver);
                                                stage.addEventListener(Event.ENTER_FRAME, moveScroll );
                                                stage.addEventListener(Event.ENTER_FRAME, moveObjects);
                                                                // set arrow variables to true
                                 private function keyPressedDown(event:KeyboardEvent) {
                                                if (event.keyCode == 37) {
                                                                leftArrow = true;
                                                } else if (event.keyCode == 39) {
                                                                rightArrow = true;
                                // set arrow variables to false
                                private function keyPressedUp(event:KeyboardEvent) {
                                                if (event.keyCode == 37) {
                                                                leftArrow = false;
                                                } else if (event.keyCode == 39) {
                                                                rightArrow = false;
                                // move every frame
                                private function movesky_Diver(event:Event) {
                                                var speed:Number = 15;
                                                if (leftArrow) {
                                                                sky_Diver.x -= speed;
                                                if (rightArrow) {
                                                                sky_Diver.x += speed;
                        public function moveScroll(e:Event):void{
                                                BackGround.y -= scrollSpeed;
                                                BackGround2.y -= scrollSpeed;
                                                 if ( BackGround.y < -BackGround.height){
                                                  BackGround.y = BackGround.height;
                                                else if (BackGround2.y < -BackGround2.height){
                                                                BackGround2.y = BackGround2.height;
                                                public function setNextObject() {
                                                nextObject = new Timer(500+Math.random()*1000,1);
                                                nextObject.addEventListener(TimerEvent.TIMER_COMPLETE,newObject);
                                                nextObject.start();
                                public function newObject(e:Event) {
                                                var goodObjects:Array = ["cloud"];
                                                var badObjects:Array = ["plane", "bird"];
                                                if (Math.random() < .5) {
                                                                var r:int = Math.floor(Math.random()*goodObjects.length);
                                                                var classRef:Class = getDefinitionByName(goodObjects[r]) as Class;
                                                                var newObject:MovieClip = new classRef();
                                                                newObject.typestr = "good";
                                                } else {
                                                                r = Math.floor(Math.random()*badObjects.length);
                                                                classRef = getDefinitionByName(badObjects[r]) as Class;
                                                                newObject = new classRef();
                                                                newObject.typestr = "bad";
                                                newObject.x = Math.random()*500;
                                                newObject.y = stage.stageHeight;
                                                addChild(newObject);
                                                objects.push(newObject);
                                                setNextObject();
                                public function moveObjects(e:Event) {
                                                for(var i:int=objects.length-1;i>=0;i--) {
                                                                objects[i].y -= speed;
                                                                if (objects[i].y < 0) {
                                                                removeChild(objects[i]);
                                                                objects.splice(i,1);
                                                                if (objects[i].hitTestObject(sky_Diver)) {
                                                                                if (objects[i].typestr == "good") {
                                                                                                 score += 1;
                                                                                } else {
                                                                                                 score -= 1;
                                                                                if (score < 0) score = 0;
                                                                                scoreDisplay.text = "Score: "+score;
                                                                                removeChild(objects[i]);
                                                                                objects.splice(i,1);

Chipleh is probably right as far as the order in which you add things.  Another thing you might not realize is that within a few lines of code you reparent the background...
BackGroundContainer = new MovieClip(); 
BackGroundContainer.addChild( BackGround ); // first you add it to the container
BackGroundContainer.addChild( BackGround2 );
stage.addChild(BackGroundContainer);
stage.addChild(BackGround); // then you relocate it onto the stage

Similar Messages

  • How can I disable "Show hidden objects" by default?

    I've started linking to files on my computer like this, 'Index of file:///Users/michaelo/Dropbox/KN' which works fine apart from the fact that this calls up all the hidden files, which do not want to see by default.
    There's a checkbox "Show hidden objects" which will hide these when unchecked. But settings are per folder and of course aren't remembered between sessions.
    Is there a way via about:config to hide hidden objects by default?
    TIA
    x MO

    *[https://addons.mozilla.org/firefox/addon/settingsanity/ SettingSanity] (adds back removed options for JavaScript, Advanced JavaScript Settings, loading images, and showing the Tab Bar)

  • 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.

  • Hidden objects in UNX causing errors in Web I reports

    Hello All,
    Is there a change in behaviour regarding hidden objects in universe? In earlier version of BO, we can hide a objects in universe and can still refresh the reports in WEB I based on that hidden objects.
    Right now in BO 4.1, when I hide a object in universe (.UNX) the reports are throwing errors. Any suggestions on how it can be resolved?
    Thanks

    Hello,
    It would be helpful if you provide the error message.
    There are several articles about similar problem, like:
    https://service.sap.com/sap/support/notes/1848566
    https://service.sap.com/sap/support/notes/1943645
    https://service.sap.com/sap/support/notes/1937725
    Thanks and Regards,
    Rabeb

  • How NOT to select hidden objects

    Hi,
    could somebody please tell me if there's a way NOT to select hidden or locked objects inside a layer/group every time that layer/group is selected in the layer pallette? It's a minor but a very annoying thing, due to which I'm always unintentionally shifting or deleting ojbects that I need to stay in place (which is why they've been locked or hidden in the first place).
    Thank you for your help!

    m00n_s00n wrote:
    Hi,
    could somebody please tell me if there's a way NOT to select hidden or locked objects inside a layer/group every time that layer/group is selected in the layer pallette?....
    If you select the group in the layers palette, by clicking the selection column to the far right next to the group's name, it will not select locked/hidden objects. Unfortunately this doesn't work for a layer and if you have more groups in a layer you have to Shift click on the selection column of each group.
    When you drag copy by holding Alt objects selected like that the copies remain in the same group it doesn't create a new group minus the locked/hidden objects.

  • Performance issue in correlation with hidden objects in reports

    Hello,
    is there a known performance issue in correlation with hidden objects in reports using conditional suppressions? (HFM version 11.1.2.1)
    Using comprehensive reports, we have huge performance differences between the same reports with and without hidden objects. Furthermore we suspect that some trouble with our reporting server environment base on using these reports through enduser.
    Every advice would be welcome!
    Regards,
    bsc
    Edited by: 972676 on Nov 22, 2012 11:27 AM

    If you said that working with EVDRE for each separate sheet is fin ethat's means the main problem it is related to your VB custom macro interdependecy.
    I suggest to add a log (to write into a text file)for you Macro and you will se that actually that minute is staying to perform operations from custom Macro.
    Kind Regards
    Sorin Radulescu

  • Hidden objects garden  I try to buy mre gold bars.a message saying I need to contact iTunes support to complete this transaction

    Hidden objects the garden   I buy more gold. Bars in the app. It tells me I need to contact iTunes support to finish this transaction itry to finish in iTunes but no lick. This has been going on for 2 days. I had no problem with. Score  Tuesday 8-7-12

    You should do exactly what it said to do and contact itunes support.

  • Remove all the hidden objects in PDF using acrobat SDK

    Hi Friends
                   How to remove all the hidden objects in PDF using acrobat sdk 11

    Sorry if I re open this old thread, but I am interested in the 'Remove Hidden Information' command.
    Which is the AVCommand to run this feature?
    Thanks

  • How come there are no hidden objects games in the South African App Store and y does safari not allow you to get it downloaded from the net. There are only games for kids in the App Store. Can anyone help

    How come there are no hidden objects games in the South African App Store and y does safari not allow you to get it downloaded from the net. There are only games for kids in the App Store. Can anyone help.  Is the South African apple ipad only for children

    Nobody here is responsible for what is or is not available in any country. I believe it is a software licensing thing.

  • Problem with hidden objects when moving layers, groups or artboards

    Hi there,
    I am using Illustrator CS5.5 on a Mac.
    Sometimes, after moving stuff around (groups, layers or artboards), I notice that hidden objects didn't move with everything else.
    Does somebody knows how this can be if no objects are locked ?
    I cannot make this happen on purpose with a simple example and it is really annoying not to be sure that everything was moved properly.
    Thanks
    R.

    Emil,
    A little misunderstanding here.
    Like you say, clicking on the target to select (targeting objects) : this is exactly what I do.
    So, SOMETIMES, when I select a group (not a layer) which contains hidden objects by clicking on its target in the layers panel, only the visible objects get selected (i.e. : only the visible objects get a full square at their right in the layers palette and the group gets a small square) AND the group is NOT targeted at all (i.e. : the target of the group is not highlighted, only the targets of the selected (visible) objects within the group are highlighted).
    Then, if I move the group, only the visible objects are moved because only those are selected.
    Problem is that I don't know why but when doing this (targeting objects), SOMETIMES this result in selecting everything within the group BUT SOMETIMES it result in selecting only the visible objects withtin the group.
    I don't know what triggers that difference in behavior.
    R.

  • An action that deletes all hidden objects

    Hello
    In a constant effort to save and place smaller files...I was wondering if there was a way to script illustrator files so that it deletes all the hidden objects.
    I end up with so many hiden objects in these files, I am sure that would be a great help, if I could set an action either inside of illustrator or through a script to drag and drop files onto to that would delete the hidden files.
    I cannot find any commands on this in the program, so I did not know if it is possible, but I figures I would try.
    thanks!
    babs

    Here's a script that I have to delete hidden layers in a file. It could be reworked to target page items. Remember you can only delete something if it is visible.
    --get a sourceFolder that holds the files to process
    set sourceFolder to (choose folder with prompt "Choose a folder with files to process:") as text
    -- get a list of files of the files to process in the sourceFolder
    tell application "Finder" to set workingFiles to (every file of folder sourceFolder) as alias list
    repeat with aFile in workingFiles
        tell application "Adobe Illustrator"
            open aFile
            set currentFile to front document
            tell application "Adobe Illustrator"
                set myLayers to every layer of currentFile
                repeat with i from 1 to count of items in myLayers
                    set myLayer to item i of myLayers
                    set locked of myLayer to false
                    if visible of myLayer is true then
                        set visible of myLayer to false
                    else if visible of myLayer is false then
                        set visible of myLayer to true
                    end if
                end repeat
                delete (every layer of currentFile whose visible is true)
            end tell
            tell application "Adobe Illustrator"
                set visible of (every layer of currentFile) to true
            end tell
            close currentFile with saving
        end tell
    end repeat

  • Get-MailboxStatistics command to run and not count hidden objects

    I have a script that generates a report on a set of mailboxes in an OU and how many messages are in the Inbox using the following command:
    Get-MailboxFolderStatistics $mailbox -FolderScope Inbox | Where {$_.FolderPath -eq "/Inbox"}
    There is a lot more to this script and it outputs a lot of information, but the count of items in the inbox is always wrong. It seems to be counting a lot of hidden items which users cannot see. From my reading in many forums this is a common problem, and
    so far I have not found a solution.
    Is there a way to fun the Get-MailboxFolderStatistics command and folder out hidden objects?

    `Thank you for the response, but unfortunately I have been tasked to find a way to get this working. I understand that the Get-MailboxStatistics command is unable to filter out hidden items but I need to find a way to make this report possible. I can understand
    the limitations of the command and the technology, but unfortunately the CEO of our company will not accept that as an answer and making this report working is not an option.
    To at least allow the report to function for now, I have created a report which manually adjusts for the hidden objects in each box. This does require the manual effort however of adjusting an input file which keeps track of the number of hidden objects
    in each box. Here is the code that generates the report:
    $mailboxes = @(get-mailbox -OrganizationalUnit "<ORGANIZATION UNIT>")
    $report = @()
    foreach ($mailbox in $mailboxes)
        $inboxstats = Get-MailboxFolderStatistics $mailbox -FolderScope Inbox | Where {$_.FolderPath -eq "/Inbox"}
        $MailboxInfo = Get-MailboxStatistics $mailbox | Select LastLoggedOnUserAccount,LastLogonTime,LastLogoffTime
        $inboxstatCount = Get-MailboxFolderStatistics $mailbox -FolderScope Inbox | Where {$_.ItemsInFolder -gt 0 -and $_.FolderType -like "Inbox"}
        $RawInboxCount = $inboxstatCount.ItemsInFolder
        if ($mailbox.DisplayName -like "BillingFaxes")
            $CurrentHiddenCount = "$HiddenCountBillingFaxes"
        If ($mailbox.DisplayName -eq "callcenter")
            $CurrentHiddenCount = $HiddenCountcallcenter
        If ($mailbox.DisplayName -eq "lab")
            $CurrentHiddenCount = $HiddenCountcathlab
        If ($mailbox.DisplayName -eq "cviholter")
            $CurrentHiddenCount = $HiddenCountcviholter
        If ($mailbox.DisplayName -eq "medrecs")
            $CurrentHiddenCount = $HiddenCountmedrecs
        If ($mailbox.DisplayName -eq "appointments")
            $CurrentHiddenCount = $HiddenCountNFRappointments
        If ($mailbox.DisplayName -eq "pharmacy")
            $CurrentHiddenCount = $HiddenCountpharmacy
        If ($mailbox.DisplayName -eq "referrals")
            $CurrentHiddenCount = $HiddenCountreferrals
        If ($mailbox.DisplayName -eq "research")
            $CurrentHiddenCount = $HiddenCountresearch
        #else
        #{ $CurrentHiddenCount = "No Value" }
        #DIAGNOSTIC VALUES OUTPUT
        Write-Host "--------------------------------------------------------------"
        Write-Host "Current Mailbox" $mailbox.DisplayName
        Write-Host "Current Inbox Count from the report=" $RawInboxCount
        Write-Host "Current Hidden Count Number" $CurrentHiddenCount
        Write-Host "The Math should equal " ($RawInboxCount - $CurrentHiddenCount)
        $mbObj = New-Object PSObject
        $mbObj | Add-Member -MemberType NoteProperty -Name "Display Name" -Value $mailbox.DisplayName
        $mbObj | Add-Member -MemberType NoteProperty -Name "Inbox Size (Mb)" -Value $inboxstats.FolderSize.ToMB()
        $mbObj | Add-Member -MemberType NoteProperty -Name "Inbox Items" -Value ($RawInboxCount - $CurrentHiddenCount)
        $mbObj | Add-Member -MemberType NoteProperty -Name "Last User to Log On" -Value $MailboxInfo.LastLoggedOnUserAccount
        $mbObj | Add-Member -MemberType NoteProperty -Name "Time User was last logged in" -Value $MailboxInfo.LastLogonTime
        $mbObj | Add-Member -MemberType NoteProperty -Name "Time User last logged off" -Value $MailboxInfo.LastLogoffTime
        $report += $mbObj
    All $Hidden----- variables are set to values from an imported file that must be updated regularly. It's messy, but at least it is getting the information we need to those that need it. If anyone can suggest a way to make this work without the constant need
    to adjust the numbers for hidden items please let me know.

  • How to find the hidden objects in Webi Rich client  report 4.0 sp 04 ?

    Hi,
    How to find the hidden objects in Webi Rich client  report  at BI 4.0 sp 04 ?
    Best Regards,
    ASR

    Hi Sai,
    Go to Report Element Tab-->There you have a Tab Cell Behaviors.
    When you flip between 'With Data' and 'Structure Only' under 'Design' Tab,you can see the some cells will be hide/Un hide behavior,if hiding of cells applied.
    Select that cell and then Under 'Cell Behaviors'-->'Hide' Tab-->and choose Show Option.
    Regards,
    Venkat P

  • How do i download/install free hidden objects games,on my laptop to play when ever i choose to play

    how do do i download/install free hidden objects games to keep and play when ever i choose to play?

    What is your operating system, version & edition?
    What is your web browser?
    What means "wont"; what happens when you try?

  • I installed a 60-minute trial version of a "hidden object" game.  How do I uninstall this. I'm through using it.

    I want to declutter my machine by ridding it of an unwanted 60-minute trial version of an internet "hidden object" game.  where do I find an "uninstall" program to wipe the slate clean of this program and its junk?

    Well Hi there 71 
    I don't trust AppCleaner or any other of its type, Job 1 is to see what the game developer has to say about removal.

  • Search Hidden object access in code

    Hi ,
    I've created a webpart and trying to access search hidden object using below statement inside onLoad event (webpart/control)
    object o = HttpContext.Current.Items["OSSSRHDC_0"];
    I am getting this object as null.Also I am unable to find any property OSSSRHDC_0 key under Items collection.Please suggest.

    Check this post, it may help:
    http://social.technet.microsoft.com/Forums/da/sharepointsearch/thread/e1ed89e7-d857-4439-8cde-f35c0ebdd211
    Brandon Atkinson
    Blog: http://brandonatkinson.blogspot.com

Maybe you are looking for

  • Transferring AR Line items

    Hi Guys Let's say we have posted a few AR line items on the wrong account. They were supposed to be on Customer A but now there are on Customer B. Is there a way to clear the line items on Customer B and post them to A ?? I know I can reverse the doc

  • Down payments from customers

    Dear Experts, My query is how can we make we down payment correlate with credit limit set in FD32. Is there a standard way to do so?

  • HT201320 How do I add another email to my phone?

    I'm trying to add an email account to my phone and it's not working. I think it's to do with the incoming and outgoing mail server host names. I follow the instructions and it's not working. Thoughts?

  • HELP! Lost work!!

    I was typing a paper on ipages when it closed without warning. I did not save before this happened. Is there anyway to get it back? Please I put a lot of work in to this I was so stupid not to save!

  • How to install J2ME application on Nokia 6600

    Can you help me in How to install J2ME application on Nokia 6600.Is it enough to build the application using J2ME wireless toolkit or we need any other Nokia SDK for it.