Help Please - Objects to Display

Hey how can i get my objects to display? In my class i have a function that creates objects and they fall randomly in rows but only 1 is displaying. And i used trace(); to test how many on stage and it said 4 but only 1 starting falling.
I think there is something wrong with the method i am using to create the objects in rows.
Heres the code:
package
    import flash.display.MovieClip;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.events.TimerEvent;
    import flash.utils.Timer;
    public class Main extends MovieClip
        public var enemyA:Array = [];
        public var birdA:Array = [];
        public var rowNum:int = 1;
        private var gap:int = 100;
        private var obj_no = 2;
        public var timer:int = 0;
        public var time_limit = 10;
        public var TimerSpeed:uint = 1000;
        public var MyTimer:Timer = new Timer(TimerSpeed);
        public var enemy1:mychar = new mychar();
        public var TheBird:BirdChar = new BirdChar();
        public function Main()
            // Constructor Code
        public function activateGameControls()
            createEnemyF();
            createBirdF();
            this.addEventListener(Event.ENTER_FRAME,loopF);
            MyTimer.addEventListener(TimerEvent.TIMER, TimerHandler);
            MyTimer.start();
        public function deactivateGameControls()
            addChild(TheBird);
            addChild(enemy1);
            removeChild(TheBird);
            removeChild(enemy1);
        public function createEnemyF()
            for (var i:int = 0; i < rowNum; i++)
                for (var j:int = 0; j < obj_no; j++)
                    enemy1.x = Math.random() * stage.stageWidth - enemy1.width;
                    enemy1.y =  -  i * (gap + enemy1.height) - 30.65;
                    enemyA.push(enemy1);
                    addChild(enemy1);
                    trace(enemy1.x, enemy1.y);
        public function createBirdF()
            TheBird.x = 270.95;
            TheBird.y = 350.95;
            birdA.push(TheBird);
            addChild(TheBird);
        public function loopF(event:Event)
            updateEnemyPositionsF();
            updateBirdPositionsF();
            hitTestF();
        public function updateEnemyPositionsF()
            enemy1.y +=  2;
        public function updateBirdPositionsF()
            TheBird.x = mouseX;
        public function hitTestF()
            if (TheBird.hitTestObject(enemy1))
                gotoAndPlay(5);
                deactivateGameControls();
                trace('The Bird Hit Enemy 1');
        function TimerHandler(event:TimerEvent)
            timer +=  1;
            if (timer == 50)
                MyTimer.removeEventListener(TimerEvent.TIMER, TimerHandler);
                MyTimer.stop();
                gotoAndPlay(4);
            else if (timer == time_limit)
                gotoAndPlay(5);
                deactivateGameControls();

Sorry, but i don't get your method on how to do this Here is my code, please give me some steps on exactly what to do and comments on why you are doing it please ..
package
    import flash.display.MovieClip;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.events.TimerEvent;
    import flash.utils.Timer;
    import flash.display.DisplayObject;
    public class Main extends MovieClip
        public var enemyA:Array = [];
        public var birdA:Array = [];
        private var gap:int = 100;
        public var timer:int = 0;
        public var time_limit = 10;
        public var TimerSpeed:uint = 1000;
        public var MyTimer:Timer = new Timer(TimerSpeed);
        public var enemy1:mychar = new mychar;
        public var TheBird:BirdChar = new BirdChar;
        public function Main()
            // Constructor Code
        public function activateGameControls()
            createEnemyF();
            createBirdF();
            this.addEventListener(Event.ENTER_FRAME,loopF);
            MyTimer.addEventListener(TimerEvent.TIMER,TimerHandler);
            MyTimer.start();
        public function deactivateGameControls()
            addChild(TheBird);
            addChild(enemy1);
            removeChild(TheBird);
            removeChild(enemy1);
//here is the function i need fixed! I want enemy1 added randomly into rows with the gap.
        public function createEnemyF()
            for (var i:int = 0; i < 10; i++)
                enemy1.x = Math.random() * stage.stageWidth - enemy1.width;
                enemy1.y =  -  i * (gap + enemy1.height) - 30.65;
                enemyA.push(enemy1);
                addChild(enemy1);
                trace(enemy1.x, enemy1.y);
        public function createBirdF()
            TheBird.x = 270.95;
            TheBird.y = 350.95;
            birdA.push(TheBird);
            addChild(TheBird);
        public function loopF(event:Event)
            updateEnemyPositionsF();
            updateBirdPositionsF();
            hitTestF();
        public function updateEnemyPositionsF()
            enemy1.y +=  2;
        public function updateBirdPositionsF()
            TheBird.x = mouseX;
        public function hitTestF()
            if (TheBird.hitTestObject(enemy1))
                gotoAndPlay(5);
                deactivateGameControls();
                trace('The Bird Hit Enemy 1');
        function TimerHandler(event:TimerEvent)
            timer +=  1;
            if ((timer == 50))
                MyTimer.removeEventListener(TimerEvent.TIMER,TimerHandler);
                MyTimer.stop();
                gotoAndPlay(4);
            else if ((timer == time_limit))
                gotoAndPlay(5);
                deactivateGameControls();
I really want to finish this so i can finish my game, you are a good help so far!

Similar Messages

  • Help please. Extended display won't work on MBP and AOC 20" 1600 x 900  60HZ monitor. Mirror display does. I've a mini dvd to vga converter cable. Should this work?

    Help please. Extended display won't work on MBP and AOC 20" 1600 x 900  60HZ monitor. Mirror display does. I've a mini dvd to vga converter cable. Should this work?

    I have the same mini display port adapter and Belkin DVI-HDMI cable (but a Panasonic 42" Plasma HDTV) so just set this up on it to see if I could duplicate your problem, unfortunately for you (but good for me) I can't.
    I connected the adapter+HDMI cable before switching the HDTV on and then powered up the MBP. It (the HDTV) came up with my background right away (it's set at Mirror not extended Desktop) and when I run System Preferences/Displays get the following. Sorry but all I can confirm is that adapter+cable combination should work ...
    Try doing a Parameter RAM reset - hold down command/option/p/r keys at start up and wait for three chimes before releasing the keys?

  • VGA CRT will not "wake up".. help please. Reset display settings shortcut?

    Hello everybody,
    I have a mirror drive doors G4 Tower, Dual 1.25 GHz.
    I have an ADC and a DVI out from the computer. Just had damage to my old studio display so I am attempting to use just one CRT running from the DVI... w/ a DVI to VGA adapter.
    The first time I tried this w/ a CRT it worked fine... I played around w/ monitor settings... still worked fine. Shut down... unhooked CRT and moved that CRT away.
    Tried using it with another CRT and the new CRT never started up... remained on stand-by/sleep.
    I tried with another moniter... this time a LCD/Flatscreen... again VGA and it did the same thing, EXCEPT... this time when I connected the LCD to the adapter and then plugged the adapter into the DVI on my tower the LCD screen would turn on for about 1 second and display my login page. The picture was not perfect though... it was distorted someway.
    Went back to the first CRT... now this one didn't work.
    I think that maybe I have to reset my display settings with some sort of shortcut or something... maybe it's on the wrong frequency?
    I don't know... any help much appreciated. I hate having to use this PC.
    Thanks,
    James

    Turned out to be a faulty DVI to VGA adapter.

  • VGA CRT will not "wake up"... help please.  Reset display settings?

    Hello everybody,
    I have a mirror drive doors G4 Tower, Dual 1.25 GHz.
    I have an ADC and a DVI out from the computer. Just had damage to my old studio display so I am attempting to use just one CRT running from the DVI... w/ a DVI to VGA adapter.
    The first time I tried this w/ a CRT it worked fine... I played around w/ monitor settings... still worked fine. Shut down... unhooked CRT and moved that CRT away.
    Tried using it with another CRT and the new CRT never started up... remained on stand-by/sleep.
    I tried with another moniter... this time a LCD/Flatscreen... again VGA and it did the same thing, EXCEPT... this time when I connected the LCD to the adapter and then plugged the adapter into the DVI on my tower the LCD screen would turn on for about 1 second and display my login page. The picture was not perfect though... it was distorted someway.
    Went back to the first CRT... now this one didn't work.
    I think that maybe I have to reset my display settings with some sort of shortcut or something... maybe it's on the wrong frequency?
    I don't know... any help much appreciated. I hate having to use this PC.
    Thanks,
    James
    G4 Dual 1.25 Mirrored Drive Doors Mac OS X (10.4.5) Some NvDia card
    G4 Dual 1.25 Mirrored Drive Doors   Mac OS X (10.4.5)   Some Nvidia Graphics card w/ DVI to VGA adapter

    Can you start up in "safe mode"? If so, you can reset your display settings and reboot. If not, you have a problem either with your video card or your DVI/VGA adaptor

  • Help Please, Problem in displaying same  JTables on two JPanels

    Problem in displaying same JTables on two JPanels. In an application, I have a dynamic display of JTables on one JPanel. After a print preview button action, I have to bring same JTables on another JPanels, while taking this the previous JPanels content(JTables) become invisible? Why this happened? may be single component. Is the Cloning process nedded?

    Hi,
    you can add a component to one container only. If you try to add it to a second container, it will be removed from the first.
    You could try holding one member of the TableModel and set that one to both tables.
    Greets,
    Christian

  • Loading and viewing XML when a class object is created..Help Please

    Hello,
    I have writing a simple class which has a method that gets invoke when the object of the class is created. I am able to view the loaded XML content when I trace it with in my class method, but cannot assign the content to a instance variable using the mutator method. So the process goes like this:
    Class object is instantiated
    Class construtor then calls the loadXML method which laods the XML
    And then assigns the XML to a class instance variable.
    So now if I would like to access the loaded XML through class object, I should be able to see the loaded xml content which I am not able to see. I have spent over few hours and cannot get the class object to display the loaded XML content. I would highly appreciate it if someone can help in the right direction, please.
    [code]
    package com.as3.app
        import flash.display.*;
        import flash.events.*;
        import flash.text.*;
        import flash.net.*;
        public class Cars extends MovieClip {
               public var _CarList:Object;
               public function Quiz()
                  super();
                  loadCars();
    // ===========================================================
    //           CARS GETTER SETTER
    // ===========================================================
            public function set Cars(val:XML):void
                this._CarList = val;
            public function get Cars():XML
                return this._CarList;
    // ===========================================================
    //            LOAD QUESTIONS FROM XML
    // ===========================================================
            public function loadcars()
                var myXML:XML;
                var myLoader:URLLoader = new URLLoader();
                myLoader.load(new URLRequest("xml/cars.xml"));
                myLoader.addEventListener(Event.COMPLETE, processXML);
                function processXML(e:Event):void
                    myXML = new XML(e.target.data);  
                    Cars = myXML;                 // Assigning the loaded xml data via mutator method to the _CarList;
    //=============================================================  
                                  INSTANTIATING THE CLASS OBJECT
    //=============================================================
    package com.as3.app
        import flash.display.*;
        import flash.events.*;
        import flash.text.*;
        import flash.net.*;
        import com.as3.app.*;
        public class DocumentClass extends MovieClip {
            public var c:Car;
            public function DocumentClass()
                super();
                c = new Cars();  
                trace(c.Cars);
    [/code

    where you have:
                super();
                c = new Cars();  
                trace(c.Cars);
    c.Cars will not trace as the loaded xml, because it will not have loaded in time. After some time it should presumably have the correct value.
    loading operations in actionscript are asynchronous, so your nested function which is acting as the listener ( function processXML(e:Event):void) only ever executes when the raw xml data has loaded and that is (I believe, not 100% sure) always at least one frame subsequent to the current one.
    In general I would consider it bad practise to use nested functions like that, but I don't think its contributing to your issues here. I think its just a timing issue given how things work in flash....
    Additional observation:
    your Cars constructor calls loadCars() and your loadCars method is defined as:
    public function loadcars()
    I assume its just a typo in the forum that the uppercase is missing in the function name....

  • In my Iphone 5, Nothing on my App Store is working its displaying blank (Except for Genius section). I've tried to uninstall and install itunes and all its component but still it doen't fix. Not sure if its problem with apple servers. Someone help please!

    In my Iphone 5, Nothing on my App Store is working,  its displaying blank (Except for Genius section). I've tried to uninstall and install itunes and all its component in my desktop but still it doesn't fix the app store issue. Not sure if its problem with apple servers. Someone help please!

    settigns>itunes and app store to make sure you are signed in.. If  you are, you will see your account name..... anyhow, click your account name, sign out and sign back in
    also go to to settings>general>reset and reset network settings... if that doesnt work settings>general>reset and reset all settings!
    one of those shall work. The last step would be to restore your device (apple.com/support) HT1414

  • After my iphone4S update to 7.0.6, it have a problem that keep searching network then no service show on display. Can't call. I have try check sim card, reset network settings, and restore my iphone. Still not working at all. Need help please.

    After my iphone4S update to 7.0.6, it have a problem that keep searching network then no service show on display. Can't call. I have try check sim card, reset network settings, and restore my iphone. Still not working at all. Need help please.Urgent.TQ

    Izit software or hardware? Confuse:(
    Only can use wifi now.
    Any way thanks guys for ur suggestion:) amishcake and simes

  • I just switched from Outlook to Mail and now the sent messages are not being displayed.  Help, please.

    I just switched from Outlook to Mail and now the sent messages are not being displayed.  Help, please.

    Back up all data. Rebuild the mailbox.

  • My anchored objects dont display after CS5 upgrade - help?

    Hi,
    We've just upgraded to CS5 from CS3.
    I publish educational books, which contain a lot of object styles and anchored objects.
    I have just opend a book im working on in CS5 and have had problems with both anchored objects not displaying and object styles changing. The first is more pressing.
    The problem arises where I have an anchored object inside another anchored object, and they use custom positioning.
    For example. I have a pullout box that contains text and an image. The image is anchored inside the pullout box and the pullout box is anchored to the main body of text.
    The images are no longer displaying. I can select their frames, and if i change the image positioning to inline the images display fine, but when it is set to custom (which they need to be) I can no longer see the image.
    Is anyone able to help with this, its a major problem as i am woking with hundreds of images here.
    Thanks

    My usual advice is that with a project this large, it's best to finish it in the same version it was started in. Even a small change in the text engine can effect things like this and there were changes from CS3 to CS4 and again to CS5, but I'm not really sure what's happening in your case.
    Bob

  • My MacBook pro retina display 15 inch (2013) doesn't start. After I press the start button there is only a beep sound at regular interval. The screen remains blank and the keys don,t light up. Can anyone help please?

    My MacBook pro retina display 15 inch (2013) doesn't start. After I press the start button there is only a beep sound at regular interval. The screen remains blank and the keys don,t light up. Can anyone help please?

    If your MBP is under warranty, bring it to an Apple store and have the technicians fix it.  If not, try the steps in this support article:
    http://support.apple.com/kb/ts2570
    Ciao.

  • Apple iPAD 2.  Needs password to unlock iPAD; however there is a permanent keyboard displayed on the screen that does not respond to touch. iPAD switches on with button but does not turn off using it at moment.  Can you help please?

    Apple iPAD 2.  Needs password to unlock iPAD; however there is a permanent keyboard displayed on the screen that does not respond to touch. iPAD switches on with button but does not turn off using it at moment.  Can you help please?

    Try a reboot by holding both the power and home buttons until the apple logo appears, ignore the red slider if that appears.  See if that clears the glitch.

  • TS4006 I tried to log on to find my iPhone but it keeps displaying that I have poor connection error!! But My connection is fine??? Help please?

    Downloaded it.. When I Try to log on for the first time it says connection error or server error! Now everything else works on my phone and my partner can log onto hers and all settings are the same? Help please, thanks in advance

    No. If it is offline then it is not capable of being located over the web.

  • Last Project -- Need Help, Please

    Okay, this is my last project, and I am struggling with it. The specification we were given was to write a program that reads in a file of dates and outputs the dates in descending order, using a priority queue. The PriorityQueue should implement the PriorityQueueInterface interface, and should implements a priority queue using a singly linked list. The list should be maintained in sorted order. This implementation should not use a heap.
    I have the code built, but when I run it is not reading my dates fully, and I get an error message. The LinkList is already built for us, but here is the rest of my code. First I input from my dates.txt:
    11/12/2000
    04/04/2004
    01/02/1998
    import java.io.*;
    public class DateDriver {
       public static void main(String[] args) throws IOException {
          PriorityQueue pq = new PriorityQueue();
          // ... read all Date objects from the file and enqueue them in the pq object
          BufferedReader in = new BufferedReader (new FileReader("C:/Users/April/Desktop/UMUC/CMIS241/Project4/Dates.txt"));
          Date date = new Date();
          date.input(in);
          while (!date.isNull()){
               pq.add(date);
               date = new Date();
               date.input(in);
               System.out.println(date);
          // ... dequeue the pq object and display the Date objects
          System.out.println("The dates in descending order are: ");
          while (!pq.isEmpty()){
               date = (Date) pq.dequeue();
               date.output(System.out);
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.PrintStream;
    public class Date implements InOutputable, Comparable {
       // ... define monthNames as a ?static final? array of String objects
       //  initialize the array with the first 3 characters of each month
         static final String[] monthNames = {null, "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep",
              "Oct", "Nov", "Dec"};
       // ... define the instance variables of class Date, i.e. day, month, year
         private String monthAbr, date;
         private int month, day, year;
       // ... define the default constructor (initializes the instance variables to zero)
         public Date(){
              this.date = "";
              month = 00;
              day = 00;
              year = 0000;
       // ... define the method toString
       //     This method should return the corresponding Date string in the following format: Nov, 11, 2006
         public String toString() {
               return (monthAbr + ", " + day + ", " + year);
       // ... define the methods specified by the interface InOutputable
    public boolean equals(InOutputable other) {
         Date otherDate = (Date) other;
         if (month == otherDate.month && day == otherDate.day && year == otherDate.year)
              return true;
         else
              return false;
    public void input(BufferedReader in) throws IOException {
         date = in.readLine();
         if (date == null)
              return;
         month = Integer.parseInt(date.substring(0, 2));
         day = Integer.parseInt(date.substring(3, 5));
         year = Integer.parseInt(date.substring(6, 10));
    public boolean isNull() {
         if (month == 0 && day == 0 && year == 0)
              return true;
         else
              return false;
    public void output(PrintStream writer) {
         writer.println(toString());
       // ... define the method specified by the interface Comparable
    public int compareTo(Object o) {
         Date otherDate = (Date) o;
         if(month == otherDate.month && day == otherDate.day && year == otherDate.year)
              return 0;
         else if (month >= otherDate.month && day >= otherDate.day && year >= otherDate.year)
              return 1;
         else
              return -1;
    public class PriorityQueue implements PriorityQueueInterface {   
       private RefSortedList lst = new RefSortedList();
       // ... define the methods specified by the interface PriorityQueueInterface
    public Comparable dequeue() throws EmptyQueue {
         return null;
    public void enqueue(Comparable key) throws FullQueue {
    public boolean isEmpty() {
         return false;
       // ... Use the lst object (by invoking list specific methods on it) when
       //     defining the PriorityQueueInterface methods.
       //     For example, method enqueue should be implemented by invoking list method add.
    public void add(Date date){
         lst.add(date);
    public void remove(Date date){
         lst.remove(date);
    }My output:
    Exception in thread "main" java.lang.NullPointerException
         at DateDriver.main(DateDriver.java:27)
    null, 4, 2004
    null, 2, 1998
    null, 0, 0
    The dates in descending order are:
    Can anybody please point me in the right direction? I know I am missing something, but I am unable to pinpoint it. I don't understand why the date.output(System.out) is throwing a null pointer exception. I am still working, but I thought maybe a fresh pair of eyes would help me.

    Dates implement Comparable... no need to sort them yourself
    SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
    LinkedList<Date> dtes = new LinkedList<Date>();
    BufferedReader in = new BufferedReader (new FileReader("C:/dates.txt"));
    while (in.read()>0){
    dtes.add(sdf.parse(in.readLine()));
    }Edited by: wpp289 on Dec 11, 2008 1:27 PM

  • My Mac Book Pro was really slow at everything and would kick me out of my photos every time i got on them. now it won't even allow me to log on. i put my password in and the screen will flash white and go back to the login page. HELP please...

    My Mac Book Pro was really slow at everything and would kick me out of my photos every time i got on them. now it won't even allow me to log on. i put my password in and the screen will flash white and go back to the login page. HELP please...

    There is nothing wrong with your Dell, it will work fine with any MacbookPro. I have been using Dell displays for over 12 years with many different Mac models. I have two 21" Ultra Sharp displays working side by side to design a Keynote presentation right now.
    The issue your having is with the way Keynote  takes control of the video output to both displays, it sends the presentation signal to one and the presenter display to the other, this is set up in;
    Keynote preferences > Presenter display.
    If you want to show a wesite or another app on  either display,  use application switcher:
    press the the  command key on the keyboard, then the tab key; a row of applications will show what applications are running, choose which one you want to show. Use command  > tab to return to Keynote.

Maybe you are looking for

  • How do I delete all the culled images at once?

    I'm importing masses of images and using the stack function to pick the best and nuke the worst of similar images. That part works fine. When I give an image a "0", Aperture puts them in the "Rejected" folder. How do I empty that folder in one step?

  • External tv monitor problems

    I'm trying to burn a DVD through a DVD recorder and wanting to see the video on a TV screen attached to the DVD recorder.  I have two problems I can't figure out:  1) I'm getting sound and a picture on the TV screen, but the picture is frozen and the

  • Problem adding music to my phone

    When ever I try to add music to my phone, it prepares to sync but then skips syncing and say that it is copying diagnostic information and then goes back to try and sync. After that it trys to add the music then just deletes all the music I already h

  • Camera and photo booth is disappeared

    Camera and photo booth is disappeared

  • Cost Elements (Data Migration)

    Dear Experts, I am new to data migration. I would like to check whether do we need to migrate controlling documents relating to cost elements (Primary and Secondary)  to the new system. If yes, where can I find the information Thank you in advance.