views:

675

answers:

2

I am trying to embed a movieClip with flashDevelop but apparently its not working because its not recognizing the movieclips that are within it. here is my code

package com.objects{

    import flash.display.MovieClip
    import flash.text.TextField;
    import flash.events.*;
    import flash.text.TextFormat;

    [Embed(source='../../../lib/fighter.swf', symbol='InfoBox')] 
    public class InfoBox extends gameObject {

        protected var textf:TextField;
        protected var s:String;
        public var type:Boolean = false;
        private var letter:Number = 0;
        private var string:Array;
        private var line:Number = 0;
        private var portNum:Array;


        public function InfoBox():void
        {
            portNum = new Array();
            portrait.stop();
            x = 400;
            y = 550;

            string = new Array();
            var format = new TextFormat();
            format.size = 18;
            textf = new TextField();
            textf.width = 550;
            textf.height = 85;
            textf.x = -220;
            textf.y = -60;
            textf.wordWrap = true;
            textf.defaultTextFormat = format;
            addChild(textf);
            contButton.addEventListener(MouseEvent.MOUSE_DOWN, StoryNext);
        }

        private function StoryNext(e:MouseEvent):void
        {
            if(string.length > 1)
            {
                portNum.splice(0,1);
                string.splice(0,1);
                trace(string.length);
                letter = 0;
            }
            else
            {
                contButton.removeEventListener(MouseEvent.MOUSE_DOWN, StoryNext);
                dispatchEvent(new Event("StoryContinue"));
            }
        }

        public function textInfo(msg:String,num:Number = 1):void
        {
            string.push(msg);
            portNum.push(num);
        }

        override public function updateObject():void
        {
            TypeWords();

        }// End UpdateObject

        public function TypeWords():void
        {
            if(type)
            {
                portrait.gotoAndStop(portNum[0]);
                var s:String = string[0];               
                if(letter <= s.length)
                {
                    textf.text = s.substring(0,letter);
                }               
                letter++
            }
        }
    }
}

and I am getting this error

C:\Users\numerical25\Documents\RealGames\FighterPilot\beta1FlashDev\src\com\objects\InfoBox.as(23): col: 4 Error: Access of undefined property portrait.

portrait is a movie clip that I have inside of the info box movie clip. it is already on the stage and i gave it a instance name of portrait. It worked in flash, but now its not in flashDevelop

+1  A: 

You need to define the corresponding properties on your class. In this case you can add:

public var portrait:MovieClip;

If it's some other type, for instance a Sprite you can change the definition to that.

EDIT: If you're having trouble setting up Flash Develop, I wrote some tutorials on that

grapefrukt
ok, what if I can not see InfoBox from within Symbols from my flash develop project. I been trying all night just to get some symbols to show and they wont
numerical25
There is something wrong with my flash develop. I need to figure it out. I compile my applicaion and nothing happens even when I put a trace in the main
numerical25
if you're not getting traces, you need to make sure you're compiling in debug (it's a selectbox right next to the compile button) AND that you have a debug flash player, if you do, you should have a debugger-option in the right click menu.
grapefrukt
A: 

[Embed(source='../../../lib/fighter.swf', symbol='InfoBox')]

I'd say use SWCs not SWFs, it will make it a **load easier.

SWCs keep all the stuff in place, whereas the swf can remove assets that are not used to save room.

Also in your flash develop panel you will see the swc (like the swf) and see all the classes that are included. Just right-click on it and add it to library. You won't have to use the [embed] code.

give that a try first, unless you absolutely need an swf.

To create an swc, use the flash tab under publish settings.

Daniel