• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Issues with simple banner

Guest
Sep 15, 2009 Sep 15, 2009

Copy link to clipboard

Copied

OK, I am trying to rework an AS1 piece for the learning process of trying to get used to AS3.  The original is not my piece - but it is something worth trying to figure out.

Basically, it pulls information from an external text file, and plays some simple animation.

At one point, I had everything working fine.

Then, in the process of trying to actually set things up for the animation using the external class, I went searching for help on animating the text pulled from the file, and was pointed (by a Developer Expert that claimed to be from Adobe) to Caurina Tweener to do this.

OK, so I did.  And at first, it worked.

Then, following the documentation, I tried adding an "onComplete" to the code for the Tweener class.  Of course, then I got an error stating:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at externalText/completeHandler()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/onComplete()

So, since everything was working correctly BEFORE I added the onComplete() reference, I went back to that working version.  Except even after saving, after commenting everything out, after even DELETING everything that talks about that - I continue to get the same error even when the actual code is nowhere to be found in the external AS file.

I've restarted my computer, I have even reinstalled Flash thinking that maybe, just maybe, the issue is because my Flash CS4 was crashing, and therefore got corrupted.

I even contacted Adobe.  Not that I am impressed with their support - the person who has been "helping" me doesn't even READ the issues I am putting forward.  I used to work in tech support - this person's work is COMPLETELY unacceptable.  I've already put in a complaint about it.

I've started new files with the same code, and now I still get the SAME error with that code.  I have no clue what I am doing wrong.

So, here - I am uploading the file that is giving me the issues - maybe someone else can find what the heck I am doing wrong.

I have to assume that you (if you are helping me out) will already have the Caurina Tweener - because it won't let me add that as well.

Thanks.

Cat

PS:  It won't let me upload my text file - so here's the info:

TEXT FILE:

logo=Yoursitetitle.com
&slogan= Optional company slogan or phrase goes here...
&textline1=Professional Gear
&textline2=Top Brand Names
&textline3=Affordable Prices
&textline4=Everything You Need
&linkLocation=index.html

PS2:  It won't let me upload my AS file either, so here is THAT code:

package {
    import flash.display.*;
    import flash.events.*;
    import flash.net.URLLoader;
    import flash.net.URLLoaderDataFormat;
    import flash.net.URLRequest;
    import flash.text.TextField;
    import flash.text.TextFormat;
    import flash.text.TextFieldAutoSize;
    import caurina.transitions.*;
   
    public class externalText extends Sprite {
        //variables for controlling the external data
        private var logoText:String;
        private var logoField:TextField;
        private var logoFormat:TextFormat;
        private var sloganText:String;
        private var sloganField:TextField;
        private var sloganFormat:TextFormat;
        private var market1Text:String;
        private var market1Field:TextField;
        private var market1Format:TextFormat;
        private var market2Text:String;
        private var market2Field:TextField;
        private var market2Format:TextFormat;
        private var market3Text:String;
        private var market3Field:TextField;
        private var market3Format:TextFormat;
        private var market4Text:String;
        private var market4Field:TextField;
        private var marketFormat:TextFormat;
        private var mktBox:MovieClip;
        private var mktBox2:MovieClip;
        private var mktBox3:MovieClip;
        private var mktBox4:MovieClip;
//        private var container:Sprite = new Sprite();
       
        //variables for controlling location and sizes of the external data
        private var bgColor:uint = 0xFFFFFF;
        private var marketStartX:int;
        private var marketStartY:int = 15;
        private var marketHeight:int =  60;
        private var marketWidth:int = 100;
        private var logoStartX:int = -250;
        private var logoStartY:int = 0;
        private var sloganStartX:int = -250;
        private var sloganStartY:int = 25;
       
        public function externalText () {
            var requestText:URLRequest = new URLRequest("../images/flash.txt");
            var variables:URLLoader = new URLLoader();
            variables.dataFormat = URLLoaderDataFormat.VARIABLES;
            variables.addEventListener (Event.COMPLETE, completeHandler);
            try {
                variables.load (requestText);
            }
             catch (error:Error) {
                trace ("Unable to load URL: " + error);
            }
        }
        private function completeHandler (event:Event):void {
            var loader:URLLoader = URLLoader(event.target);
            logoText = loader.data.logo;
            sloganText = loader.data.slogan;
            market1Text = loader.data.textline1;
            market2Text = loader.data.textline2;
            market3Text = loader.data.textline3;
            market4Text = loader.data.textline4;
        //    trace(loader.data.linkLocation;

            logoField = new TextField();
            logoFormat = new TextFormat();
            logoField.text = logoText;
            logoField.autoSize = TextFieldAutoSize.LEFT;
            logoField.x = logoStartX;
            logoField.y = logoStartY;
            logoField.multiline = false;
            logoField.wordWrap = false;
            logoFormat.font = "Garamond";
            logoFormat.color = "0xFFFFFF";
            logoFormat.size = 25;
            logoFormat.underline = false;
            logoField.setTextFormat(logoFormat);
            addChild(logoField);

            sloganField = new TextField();
            sloganFormat = new TextFormat();
            sloganField.text = sloganText;
            sloganField.autoSize = TextFieldAutoSize.LEFT;
            sloganField.x = sloganStartX;
            sloganField.y = sloganStartY;
            sloganField.multiline = false;
            sloganField.wordWrap = false;
            sloganFormat.font = "Garamond";
            sloganFormat.color = "0xFFFFFF";
            sloganFormat.size = 14;
            sloganFormat.underline = false;
            sloganField.setTextFormat(sloganFormat);
            addChild(sloganField);
           
            market1Field = new TextField();
            market1Format = new TextFormat();
            market1Field.text = market1Text;
            market1Field.autoSize = TextFieldAutoSize.LEFT;
            market1Field.y = marketStartY;
            market1Field.multiline = false;
            market1Field.wordWrap = false;
            market1Format.font = "Garamond";
            market1Format.color = "0xFFFFFF";
            market1Format.size = 18;
            market1Format.underline = false;
            market1Format.bold = true;
            market1Format.letterSpacing = 1;
            market1Field.height = marketHeight;
            market1Field.width = marketWidth;
            market1Field.setTextFormat(market1Format);
            mktBox = new marketingBox();
            mktBox.x = (stage.stageWidth - market1Field.width - 10);
            mktBox.width = marketWidth;
            mktBox.height = marketHeight;
            mktBox.alpha = 0;
            addChild(mktBox);
            mktBox.addChild(market1Field);
            mktBox2 = new marketingBox();
            mktBox2.x = (stage.stageWidth - market2Field.width - 10);
            mktBox2.width = marketWidth;
            mktBox2.height = marketHeight;
            mktBox2.alpha = 0;
            addChild(mktBox2);
            mktBox3.addChild(market2Field);
            mktBox3 = new marketingBox();
            mktBox3.x = (stage.stageWidth - market3Field.width - 10);
            mktBox3.width = marketWidth;
            mktBox3.height = marketHeight;
            mktBox3.alpha = 0;
            addChild(mktBox3);
            mktBox3.addChild(market3Field);
            mktBox4 = new marketingBox();
            mktBox4.x = (stage.stageWidth - market4Field.width - 10);
            mktBox4.width = marketWidth;
            mktBox4.height = marketHeight;
            mktBox4.alpha = 0;
            addChild(mktBox4);
            mktBox4.addChild(market4Field);
           
            addEventListener(Event.ENTER_FRAME, animateMarketing);
           
            function animateMarketing (e:Event):void {
                if (logoField.x <= 5) {
                    logoField.x += 5;
                    if (logoField.x > 5) {
                        logoField.x = 5;
                    }
                }
                trace ("And we're moving")
            }
               
//                Tweener.addTween(logoField, {x: 10, time: 10});
//                Tweener.addTween(sloganField, {x: 10, time: 10});
//                Tweener.addTween(mktBox, {alpha: 1, scaleX: 1, scaleY: 1, time: 10});
//                Tweener.addTween(mktBox, {alpha: 0, time: 10});
        }
    }
}

And now it won't let me attach the FLA file.  It's a simple file - it's 750 x 50, background is blue.  And it has a "button" that allows essentially the whole banner to be a "Home" link when the piece is put on a web page.

TOPICS
ActionScript

Views

737

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 15, 2009 Sep 15, 2009

Copy link to clipboard

Copied

Hi,

I analyze your code and you need some corrections.

the following code helps you.

package {
    import flash.display.*;
    import flash.events.*;
    import flash.net.URLLoader;
    import flash.net.URLLoaderDataFormat;
    import flash.net.URLRequest;
    import flash.text.TextField;
    import flash.text.TextFormat;
    import flash.text.TextFieldAutoSize;
    import caurina.transitions.*;
  
    public class externalText extends Sprite {
        //variables for controlling the external data
        private var logoText:String;
        private var logoField:TextField;
        private var logoFormat:TextFormat;
        private var sloganText:String;
        private var sloganField:TextField;
        private var sloganFormat:TextFormat;
        private var market1Text:String;
        private var market1Field:TextField;
        private var market1Format:TextFormat;
        private var market2Text:String;
        private var market2Field:TextField;
        private var market2Format:TextFormat;
        private var market3Text:String;
        private var market3Field:TextField;
        private var market3Format:TextFormat;
        private var market4Text:String;
        private var market4Field:TextField;
        private var marketFormat:TextFormat;
        private var mktBox:MovieClip;
        private var mktBox2:MovieClip;
        private var mktBox3:MovieClip;
        private var mktBox4:MovieClip;
//        private var container:Sprite = new Sprite();
      
        //variables for controlling location and sizes of the external data
        private var bgColor:uint = 0xFFFFFF;
        private var marketStartX:int;
        private var marketStartY:int = 15;
        private var marketHeight:int =  60;
        private var marketWidth:int = 100;
        private var logoStartX:int = -250;
        private var logoStartY:int = 0;
        private var sloganStartX:int = -250;
        private var sloganStartY:int = 25;
      
        public function externalText () {
            var requestText:URLRequest = new URLRequest("flash.txt");
            var variables:URLLoader = new URLLoader();
            variables.dataFormat = URLLoaderDataFormat.VARIABLES;
            variables.addEventListener (Event.COMPLETE, completeHandler);
            try {
                variables.load (requestText);
            }
             catch (error:Error) {
                trace ("Unable to load URL: " + error);
            }
        }
        private function completeHandler (event:Event):void {
           
            var loader:URLLoader = URLLoader(event.target);
            logoText = loader.data.logo;
            sloganText = loader.data.slogan;
            market1Text = loader.data.textline1;
            market2Text = loader.data.textline2;
            market3Text = loader.data.textline3;
            market4Text = loader.data.textline4;
        //    trace(loader.data.linkLocation;

            logoField = new TextField();
            logoFormat = new TextFormat();
            logoField.text = logoText;
            logoField.autoSize = TextFieldAutoSize.LEFT;
            logoField.x = logoStartX;
            logoField.y = logoStartY;
            logoField.multiline = false;
            logoField.wordWrap = false;
            logoFormat.font = "Garamond";
            logoFormat.color = "0xFFFFFF";
            logoFormat.size = 25;
            logoFormat.underline = false;
            logoField.setTextFormat(logoFormat);
            addChild(logoField);

            sloganField = new TextField();
            sloganFormat = new TextFormat();
            sloganField.text = sloganText;
            sloganField.autoSize = TextFieldAutoSize.LEFT;
            sloganField.x = sloganStartX;
            sloganField.y = sloganStartY;
            sloganField.multiline = false;
            sloganField.wordWrap = false;
            sloganFormat.font = "Garamond";
            sloganFormat.color = "0xFFFFFF";
            sloganFormat.size = 14;
            sloganFormat.underline = false;
            sloganField.setTextFormat(sloganFormat);
            addChild(sloganField);
          
            market1Field = new TextField();
            market1Format = new TextFormat();
            market1Field.text = market1Text;
            market1Field.autoSize = TextFieldAutoSize.LEFT;
            market1Field.y = marketStartY;
            market1Field.multiline = false;
            market1Field.wordWrap = false;
            market1Format.font = "Garamond";
            market1Format.color = "0xFFFFFF";
            market1Format.size = 18;
            market1Format.underline = false;
            market1Format.bold = true;
            market1Format.letterSpacing = 1;
            market1Field.height = marketHeight;
            market1Field.width = marketWidth;
            market1Field.setTextFormat(market1Format);
            mktBox = new marketingBox();
            mktBox.x = (stage.stageWidth - market1Field.width - 10);
            mktBox.width = marketWidth;
            mktBox.height = marketHeight;
            mktBox.alpha = 0;
            addChild(mktBox);
            mktBox.addChild(market1Field);
            mktBox2 = new marketingBox();
         //  mktBox2.x = (stage.stageWidth - market2Field.width - 10);
            mktBox2.width = marketWidth;
            mktBox2.height = marketHeight;
            mktBox2.alpha = 0;
            addChild(mktBox2);
            //mktBox3.addChild(market2Field);
            mktBox3 = new marketingBox();
          // mktBox3.x = (stage.stageWidth - market3Field.width - 10);
            mktBox3.width = marketWidth;
            mktBox3.height = marketHeight;
            mktBox3.alpha = 0;
            addChild(mktBox3);
           //mktBox3.addChild(market3Field);
            mktBox4 = new marketingBox();
          // mktBox4.x = (stage.stageWidth - market4Field.width - 10);
            mktBox4.width = marketWidth;
            mktBox4.height = marketHeight;
            mktBox4.alpha = 0;
            addChild(mktBox4);
           //mktBox4.addChild(market4Field);
          
            addEventListener(Event.ENTER_FRAME, animateMarketing);
          
            function animateMarketing (e:Event):void {
                if (logoField.x <= 5) {
                    logoField.x += 5;
                    if (logoField.x > 5) {
                        logoField.x = 5;
                    }
                }
                trace ("And we're moving")
            }
              
                Tweener.addTween(logoField, {x: 10, time: 10});
                Tweener.addTween(sloganField, {x: 10, time: 10});
                Tweener.addTween(mktBox, {alpha: 1, scaleX: 1, scaleY: 1, time: 10});
                Tweener.addTween(mktBox, {alpha: 0, time: 10});
        }
    }
}

Remove or comment the red colored code.

Regards

Saransoft

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 16, 2009 Sep 16, 2009

Copy link to clipboard

Copied

I have 4 pieces of text that must be animated - and unfortunately, those pieces you had me comment out are 3 of the 4 text boxes.

Yes, I am aware that I can use a loop to actually pull each of those in sequence, but I am not as comfortable with loops yet - I'm still learning the situation.

Commenting out those items that you asked me to do, did not fix the issue.  You did, however, show me a place (inadvertently) where I had screwed up in my code.

The code:             mktBox3.addChild(market2Field);

Should be             mktBox2.addChild(market2Field);

Thank you for trying - but I really need an answer that fixes the original problem

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 17, 2009 Sep 17, 2009

Copy link to clipboard

Copied

Hi

Just add this code..

market2Field = new TextField();

market2Field.text = market2Text;

market3Field = new TextField();

market3Field.text = market3Text;

market4Field = new TextField();

market4Field.text = market4Text;

Saransoft

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 20, 2009 Sep 20, 2009

Copy link to clipboard

Copied

Again, while you may be pointing out an issue - and I appreciate you doing so - you are not actually answering the original question.

Making your fixes does not affect what is really going on, nor does it clear the error message I am getting.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 16, 2022 Mar 16, 2022

Copy link to clipboard

Copied

Same issue in mine side i read complete replies but did not fullfill my query i am waiting for community support answer.

Thank's in Advance

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 03, 2022 Apr 03, 2022

Copy link to clipboard

Copied

LATEST

Thanks alot for raising the Issue. @Gabriel23614114uwmj, AlsoWaiting for the Solution from the Support Community Person.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines