jeudi 23 février 2017

Object Undefined but it seems to be Defined actionscript

First I am still new to coding so take it easy on me. Bit of back tracking before I show the code. I got a book on how to make games with ActionScript 3, only thing is it mainly works under the assumption your working with Photoshop & Flash Builder together rather than adobe animate/flash. So it has you do things like embed images, and I'm not sure how to change the code to define the images, which is exactly the problem. However at the same time, the stage is coming up as undefined access! I really, I mean how can the stage be undefined... Well any way, Heres an example of one of the Undefined Properties:

///
class BetterScrolling extends Sprite 
    var ForegroundImage: Class;
    var foregroundImage: DisplayObject = ForegroundImage();
    var foreground = ForegroundImage;
///

Theres some code in-between.

///
function BetterScrolling(){
     foreground.x = -((foreground.width - stage.width) / 2);
    foreground.y = -((foreground.height - stage.height) / 2);
    }

///

The point of this code is to create a scrolling Background. However I'm kinda complicating it because I have an X and an Y variable, yet I also have a slowed background in addition to my foreground. I will now link to the complete code as is currently, http://ift.tt/2luGhdL Every change in that code I made with a reason in mind, even if it is a stupid one... so please don't be distracted by the other errors that I'm sure are in there... for now just the defining of my images.

Aucun commentaire:

Enregistrer un commentaire