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

Why do I get the error "Packages cannot be nested"?

New Here ,
May 20, 2015 May 20, 2015

I had a FLA file that somehow had the AS3 erased, then I found the SWF and decompiled the file and retrieved the code.

It is the same code as before, and yet when I output it I get the error "Packages cannot be nested".

I have seen them nested before, and the Adobe site says you can do this.

What can I do?

TOPICS
ActionScript
813
Translate
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
Community Expert ,
May 20, 2015 May 20, 2015

what code is triggering the error?

Translate
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 ,
May 20, 2015 May 20, 2015

Only compiling it, when I check the syntax, no problem.

I got the code from a working SWF online, it works fine.

I am beginning to think it is corrupted.

What do you think?

Translate
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
Community Expert ,
May 20, 2015 May 20, 2015

decompiled swfs often have errors.  but you should still be able to check the code and correct it.

Translate
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 ,
May 20, 2015 May 20, 2015

I've been through it many times, I see nothing wrong.

I'm going crazy, the Adobe site says for the 1037: Packages cannot be nested if you think the file is uncorrupted you should report it to Adobe, so I did.

So I still have no clue.....

Do you want to look at it?

Translate
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
Community Expert ,
May 20, 2015 May 20, 2015

post the first and last 20 or so lines of the problematic class

Translate
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 ,
May 20, 2015 May 20, 2015

Sure! Thanks!

I will so appreciate any help!This was done by others around 2006, I think in Flex.

Beginning ...

package {

    import flash.events.*;

    import com.mayatex.*;

    import flash.display.*;

    import flash.net.*;

    import com.coderonin.*;

    public class BlanketDesigns extends MovieClip {

        private var SaddleGraphic:Class;

        public var _btnSaddleOn:SimpleButton;

        private var receiving_lc:LocalConnection;

        private var BtnSaddleOff:Class;

        public var _background:Sprite;

        public var _btnSaddleOff:SimpleButton;

        private var _blanket:String;

        public var _instructionText:Sprite;

        private var _filePath:String;

        private var BtnSaddleOn:Class;

        public var _colorSelector:ColorSelector;

        public var _sizeInputs:SizeInput;

        public var _saddleGraphic:Sprite;

        private var _colorsLoaded:Boolean = false;

        private var InstructionText:Class;

        private var sending_lc:LocalConnection;

        public var _blanketViewer:BlanketViewer;

End .....

package com.mayatex {

    import flash.events.*;

    import flash.display.*;

    public class Blanket1322C extends Blanket {

        private var button3:SimpleButton;

        private var Color1:Class;

        private var Color2:Class;

        private var Color3:Class;

        private var showControls:Boolean;

        private var button2:SimpleButton;

        private var location1:Sprite;

        private var location2:Sprite;

        private var location4:Sprite;

        private var Button3:Class;

        private var location7:Sprite;

        private var location3:Sprite;

        private var Button2:Class;

        private var location6:Sprite;

        private var Button1:Class;

        private var location5:Sprite;

        private var button1:SimpleButton;

        public function Blanket1322C(_arg1:Boolean=true){

            Color1 = Blanket1322C_Color1;

            Color2 = Blanket1322C_Color2;

            Color3 = Blanket1322C_Color3;

            Button1 = Blanket1322C_Button1;

            Button2 = Blanket1322C_Button2;

            Button3 = Blanket1322C_Button3;

            super();

            showControls = _arg1;

            draw();

            colorLocation(location1, 0);

            colorLocation(location2, 0x999999);

            colorLocation(location3, 0x666666);

            if (showControls){

                button1.addEventListener(MouseEvent.CLICK, buttonClick1);

                button2.addEventListener(MouseEvent.CLICK, buttonClick2);

                button3.addEventListener(MouseEvent.CLICK, buttonClick3);

                current_location = location1;

                current_location_number = 1;

                locationSelected();

            };

        }

        public function buttonClick2(_arg1:Event):void{

            current_location = location2;

            current_location_number = 2;

            locationSelected();

        }

        private function draw():void{

            location1 = new Color1();

            location1.width = 280;

            location1.height = 160;

            addChild(location1);

            location2 = new Color2();

            location2.width = 280;

            location2.height = 160;

            addChild(location2);

            location3 = new Color3();

            location3.width = 280;

            location3.height = 160;

            addChild(location3);

            if (showControls){

                button1 = new Button1();

                button1.x = 149;

                button1.y = 180;

                addChild(button1);

                button2 = new Button2();

                button2.x = 22;

                button2.y = 180;

                addChild(button2);

                button3 = new Button3();

                button3.x = 246;

                button3.y = 180;

                addChild(button3);

            };

        }

        public function colorLocationNum(_arg1:Number, _arg2:Number):void{

            trace(((((_arg1 + " : ") + _arg2) + " : ") + this[("location" + _arg1)]));

            if (this[("location" + _arg1)] != null){

                colorLocation(this[("location" + _arg1)], _arg2);

            };

        }

        public function buttonClick1(_arg1:Event):void{

            current_location = location1;

            current_location_number = 1;

            locationSelected();

        }

        public function buttonClick3(_arg1:Event):void{

           current_location = location3;

            current_location_number = 3;

            locationSelected();

        }

    }

}//package com.mayatex

package com.mayatex {

    import mx.core.*;

    public class Blanket1313_Button2 extends ButtonAsset {

    }

}

Translate
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 ,
May 20, 2015 May 20, 2015

It's a big file 2000 lines of AS3 or so.......

Translate
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
Community Expert ,
May 21, 2015 May 21, 2015

that's not going to work. there's no way for flash to find Blanket1322C.

put those two classes in two different class files named correctly so flash can find them.

Translate
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 ,
May 21, 2015 May 21, 2015

I will give it a try but it may be a little over my head I may have to find some help.

But thank you very much you gave me some hope!

Translate
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
Community Expert ,
May 21, 2015 May 21, 2015

for the code you showed:

from:

package {

    import flash.events.*;

    import com.mayatex.*;

    import flash.display.*;

    import flash.net.*;

    import com.coderonin.*;

    public class BlanketDesigns extends MovieClip {

// to the end of this package save as BlanketDesigns.as

and save the following in com/mayatext/Blanket1313_Button2.as

package com.mayatex {

    import mx.core.*;

    public class Blanket1313_Button2 extends ButtonAsset {

    }

.

.

.

}

Translate
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 ,
May 21, 2015 May 21, 2015

Thanks!

Translate
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
Community Expert ,
May 21, 2015 May 21, 2015
LATEST

you're welcome.

Translate
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