Skip to main content
Inspiring
September 17, 2013
Answered

Help importing a class and initializing it

  • September 17, 2013
  • 3 replies
  • 720 views

Hi guys...

I have a (what I think is) a little problem but after being the whole night awake I can´t think anymore...

I have a button which sends you to frame 10 and in frame 10 I suppose to intialize the class I imported:

import Payment;

getpremium.addEventListener(MouseEvent.CLICK, PI);

function PI(e:MouseEvent):void {

     gotoAndStop(10);

}

Now in frame 10 the only thing I have is:

Payment();

and the class (how it starts) is:

package

{

    import flash.display.Sprite;

    import flash.events.Event;

    import flash.events.IOErrorEvent;

    import flash.events.MouseEvent;

    import flash.net.URLLoader;

    import flash.net.URLRequest;

    import flash.text.TextField;

    import flash.text.TextFormat;  //etc

public class Payment extends Sprite

    {

        private var paymentSystem:PaymentSystem;

        private var buyList:List;

       

        private var loader:URLLoader;

        private var pastPurchases:Array = [];

       

        private var alltextformats:TextFormat = new TextFormat();

       

        public function Payment()

        {

            paymentSystem = new PaymentSystem(); //etc

What do I suposse to write down on frame 10 for the class to be initialized?

Thanks!!!

This topic is closed to new replies. Start a new post to keep the conversation going.
Correct answer Ned Murphy

Normally what you need to do is instantiate a Payment object...

import Payment;

var payment:Payment = new Payment();

3 replies

Ned Murphy
Ned MurphyCorrect answer
Legend
September 17, 2013

Normally what you need to do is instantiate a Payment object...

import Payment;

var payment:Payment = new Payment();

SirMarleyAuthor
Inspiring
September 18, 2013

Great!. Thanks... unfortunatelly I had to move everything into FB since the native code I need to use is not recognized in Flash CS6

Ned Murphy
Legend
September 18, 2013

You're welcome