Document class import question

I had wrote a previous post about output errors I was receiving when trying to load an xml photogallery. The error wer output errors only and ended up not effecting the swf (at least I didn't think so) after go ing nuts about a week I came across a post on another forum a few months back as someone else was asking the same question and it turns out someone else answered. It has to do with an external.as file, I know that the photogallery has other files that need to load besides the swf. the image, xml and a folder with 6 .as files.
SO I know that I was not importing those files to the swf I was calling the photogallery to load into and I now understand this but here is my question.
How do I import the 6 .as files as they sit in a folder called GS? Do I have to import each one separately thru the properties inspector?
rder

OK zip is here
http://www.mediafire.com/?eqmiyit4yi5
with the following files
main.fla / swf
folder swfs
(inside)
gallery1.fla,html,swf
gallery2.fla,html,swf
folder GS
(inside)
.as files various
folder load1
(inside)
xml, images
folder load2
(inside)
xml, images
main.swf calls the loader
problem:
galleries open and function but with output errors
I know it has something to do with importing the class paths .as files after each gallery is swapped out I should see an output message "gallery destroyed" but instead see null reference errors
any help in resolving this would be great
rdef

Similar Messages

  • Preloader and Document Class BIG question (yeap please help)

    Hy,
    I know that this its a question posted many, many times, but
    after searching the net, reading a lot of books and searching this
    forum too, I cant get out with a solution. If I'd say for sure
    there is no possibility to create something like this, I just go
    back to old methods but is not the scope of Adobe with AS3 to
    encourage the use of OOP principle or not?
    The problem:
    I have a single fla file (AS3) with a single frame on
    timeline, frame that its there when you will create the file with
    flash. In the library I have different symbols, that for simplicity
    are only jpg image, (BitmapData) checked for export for
    ActionScript and exported on frame one. An external .as file called
    DocumentClass its off course my Document Class
    This its all that I want to do with the fla, the goal its to
    create, animate etc. only with AS3 in external classes, no timeline
    script. I don't want to load external files, XML, or else in this
    movie. I just want a single swf after compilation, no additional
    files.
    Ok, how do I create a preloader that will take care of
    starting the logic after the whole swf its loaded and in the same
    time shows the user a percentage or a load bar or something that
    its not the blank screen when the swf its downloading. I want to do
    this without another swf that load this swf, or timeline scripts,
    or place all the content on second frame and then gotoAndStop to
    the third frame. All this are not solution but cheap tricks, that
    are against all this OOP principle that I just continue to read in
    books and here from guru programmers.
    The big question is:
    It is possible to create a preloader, when use a document
    class with your fla? And if yes, how?
    I know that the Document Class its not instantiated if its
    not fully loaded, if that's true when the document class will be
    fully loaded? maybe after the whole movie its loaded? And, if its
    true, it will never show a percentage bar "while" the movie its
    loaded. And if that's true WHY use a document class anyway?
    Thank you for reading this and I really wait to get some
    answer.

    I am pretty sure you cannot do self preloader with one frame
    and all the objects in the library. I guess the key here is
    one-frame design. Screen refreshes (renders) only when all the
    scripts in the frame are executed - this is a very important thing
    to understand about how Flash works. Yes, you can force screen
    refresh with updateAfterEvent() method but it is attached to a
    handful of events only (MouseEvent and TimerEvent) but, again, all
    this functionality is available only after first frame scripts are
    executed. Thus, it seems like the only way to create preloader from
    within SWF is to use multiple frames and set library objects to
    load in later (not first) frame.
    quote:
    And if that's true WHY use a document class anyway?
    Well, preloader is the last thing that would be on my mind in
    terms of using AS3 ability to link DocumentClass to the top movie.
    This feature allows for very sophisticated architectural
    approaches. It has no connection to preloader as to any other
    features developer wants to implement. Neither it depends on or
    negates timeline. As a matter of fact, although I love one-frame
    applications, I find on numerous occasions that my application
    would be more efficient if I used several (at least two) frames.
    gotoAndStop is not deprecated. It is a valid MovieClip class'
    method. After all, having only one frame doesn't mean not having
    frames at all - there is one already. Frames are fundament of
    Flash. AS3 did introduce frameless entities like Sprite, etc. but
    it doesn't mean that frames are going anywhere.
    I would agree that timeline code is inferior to
    classed/packaged (read: better organized) code but, still, how is
    it not OOP? Frame is an Object, right? Why using timeline is cheap
    and not a solution?
    On a side note, I see too many times how some authors (and
    managers) are pushing their agenda (or close mindedness) onto their
    audience with no real substantiation. Claiming that timeline in
    Flash is not valid architectural decision from OOP standpoint is
    totally wrong. As wrong as strict adherence to design patterns. I
    don't think there is sharply defined "right" or "wrong" in
    programming. One finds the best optimal solution. The goal is to
    create something that works fine. Unless, of course, the process is
    the goal - but very few of us can afford focusing on the process.

  • Document Classes and other Questions

    Basically, i am working on an application that will eventually be deployed to the desktop as an AIR application.
    I am wanting to create an Analogue clock and Digital clock with a button that toggles the display between either one when pressed. As well as this, i will be wanting to display the Date below, i am having a number of issues however.
    I have the code sorted for three of the four components, i have not attempted to figure out the button thus far as i would be more than happy to have the digital clock, analogue clock and date all being displayed on a drag and drop desktop application first. When i say i have it sorted, i have a fully working analogue clock which i have managed to display on the desktop through air on its lonesome, however, i did not include the drag and drop function. For the digital clock and date components i am not sure how to configure them into document classes. The main issue i am having is i do not know if you can reference a dynamic text box within a movie clip to a document class.
    This is the code to show the date
    [code]{
    var currentTime:Date = new Date();
    var month:Array = new Array("January","February","March","April","May","June","July","August","September","Octo ber","November","December");
    var dayOfWeek:Array = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
    date_text.text = dayOfWeek[currentTime.getDay()] + " " + currentTime.getDate() + " " + month[currentTime.getMonth()] + " " + currentTime.getFullYear();
    [/code]
    I have put the actionscript frame inside the movie clip file, and i have given both the movie clip, and the dynamic text box within the movie clip the instance name "date_text".
    Basically, i am just struggling in how to put this code into a working document class, since the digital clock and date functions are both, some what similar, i feel the solution to one will more than likely lead to me discovering the solution for the other.
    The other problem i am having, i do not know how i will display all of the components on one air application. I am assuming, that you create one other document class file which links the other four together? i have tried to do this by just linking a new FLA file with the analogue clock, but it does not work. The code for that is below.
    [code]package
              import flash.events.Event;
              import flash.display.MovieClip;
              public class time1 extends MovieClip
                        public var now:Date;
                        public function time1()
                                  // Update screen every frame
                                  addEventListener(Event.ENTER_FRAME,enterFrameHandler);
                        // Event Handling:
                        function enterFrameHandler(event:Event):void
                                  now = new Date();
                                  // Rotate clock hands
                                  hourHand_mc.rotation = now.getHours()*30+(now.getMinutes()/2);
                                  minuteHand_mc.rotation = now.getMinutes()*6+(now.getSeconds()/10);
                                  secondHand_mc.rotation = now.getSeconds()*6;
    [/code]
    That is the original clock document class (3 Movie clips for the moving hands, and the clock face is a graphic, which i may have to reference somehow below)?
    [code]package
              import flash.display.MovieClip;
              public class main extends MovieClip
                        public var hourHand_mc:time1;
                        public var minuteHand_mc:time1;
                        public var secondHand_mc:time1;
                        public function main()
                                  hourHand_mc = new SecondHand();
                                  addChild(mySecondHand);
                                  hourHand_mc.x = 75;
                                  hourHand_mc.y = 75;
                                  minuteHand_mc = new SecondHand();
                                  addChild(mySecondHand);
                                  minuteHand_mc.x = 75;
                                  minuteHand_mc.y = 75;
                                  secondHand_mc = new SecondHand();
                                  addChild(mySecondHand);
                                  secondHand.x = 75;
                                  secondHand.y = 75;
    }[/code]
    This is my attempt at creating the main document class in a seperate FLA file to attempt to load the analogue clock, and later on the Digital Clock, Date Function and Toggle Display button in the same AIR application.
    Any help on this is much appreciated, i have been reading up a lot on it through tutorials and the like, but i can't seem to fully grasp it.

    why do you have code in a movieclip?
    if you want to follow best practice and use a document class you should remove almost all code from timelines.  the only timeline code that might be reasonably used would be a stop() on the first frame of multiframe movieclips.
    so, you should have a document class.  that could contain all your code but it would be better to just have your document class create your 2 clocks and date objects and possibly manage toggling between the two clocks.  you could have a separate class the tracks the time and date and that class is used by your two clock classes and your date class.

  • Changing a document class to an imported class

    Hello everybody!
    My following document class is working fine. But, when I want to import it instead of using as a document class, it reports an error "1067: Implicit coercion of a value of type Class to an unrelated type flash.display:DisplayObject.". My class code is here:
    package
    import flash.display.Sprite;
    import flash.display.Shape;
    import flash.text.TextField;
    import flash.events.MouseEvent;
    public class Shapes extends Sprite
      var square: Sprite = new Sprite();
      var txt: TextField = new TextField();
      public function Shapes()
       square.graphics.lineStyle(4, 0xFF66CC);
       square.graphics.beginFill(0x990066);
       square.graphics.drawRect(250, 35, 175, 175);
       square.graphics.endFill();
       square.buttonMode = true;
       addChild(square);
       square.addEventListener(MouseEvent.CLICK, clickHandler);
       txt.text = "A Child of the Square";
       square.addChild(txt);
      function clickHandler(ev: MouseEvent): void
       if (square.numChildren > 0)
        square.removeChild(txt);
    My FLA file script is as below:
    import Shapes;
    addChild(Shapes);
    Seeking help, please!

    You need to create an instance of the class Shapes and tha add this isntance
    i.e. something like this
    var shapes: Shapes = new Shapes();
    addChild( shapes );

  • Document Class x / y Properties Question

    Hey guys.
    I've been working on a project in Flash CS3 for a while.  To follow an object on the screen and keep it centered, I'd adjust the Document Class' x and y properties.
    Yesterday I bought/installed Flash CS5 and thus Flash Player 10 was also installed.  Now when I go play my SWF it seems everything is all buggy, as if the code that modifies the Document Class' x and y properties isn't exactly working properly...
    I've since reopened the CS3 FLA in CS5 and converted it to a CS5 format and I can't seem to get it working the way it used to.
    Did something change regarding the Document Class and how to modify the x / y properties of it in the Flash Player 10 version?  I really don't know what's going on at this point.
    Thanks for any help.

    Sorry, but I'm starting to pull my hair out here.  Here is the bit of code in question.  This code is in a loop in an instance of the HUD class.  The "parent" of the HUD class is the Document Class:
    if (player.x < -600)
         parent.x = 1000;
         texture.x = -600;
    else if (player.x > 1400)
         parent.x = -1000;
         texture.x = 1400;
    else
         parent.x = (player.x-stage.stageWidth/2)*-1;
         texture.x = player.x;
    if (player.y < -950)
         parent.y = 1175;
         texture.y = -950;
    else if (player.y > 1400)
         parent.y = -1175;
         texture.y = 1400;
    else
         parent.y = (player.y-stage.stageHeight/2)*-1;
         texture.y = player.y;
    For some reason, it's not working like it used to.  It's hard to explain other than things are buggy.  Player hitting invisible walls, hittests not working when player actually hitting real walls, etc...  I've had this same problem before and I fixed it so I know this is the code that's doing it.  Just, I don't know what's causing the issue here other than Flash Player 10 not liking it...
    Is that even possible?  Between Flash Player 9/10 a selection of code is "interpreted" differently?

  • Cannot import SWF with document class (AS3)

    When I try to import a SWF-file (published from a FLA-file with a as3 document class) via the mx:SWFLoader into Flash Builder, the imported SWF is not showing up (as3 build a cube from papervision3d). Which way do you have to import such a SWF-file?
    Regards, Sjoerd

    Shitf+Ctrl+Enter:
    Attempting to launch and connect to Player using URL preloader.swf
    [SWF] preloader.swf - 9591 bytes after decompression
    [SWF] big.swf - 1785015 bytes after decompression
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at DocumentlClass()
    Cannot display source code at this location.
    My document class (simplyfied):
    package {
        import flash.display.Sprite;
        import flash.display.MovieClip;
        import flash.events.Event;
        import flash.events.MouseEvent;
        import fl.transitions.Tween;
        import fl.transitions.TweenEvent;
        import fl.transitions.easing.*;
        import flash.events.ProgressEvent;
        public class CarouselClass extends MovieClip {
            private vars...
            public function CarouselClass() {
                trace("document class triggered");
                    this.addEventListener(Event.ADDED_TO_STAGE,init);
            private function init(evt:Event):void{
                 texts = new Texts();
                carouselSprite = new Sprite();
                addChild(carouselSprite);
                topContainer = new Sprite();
                carouselSprite.addChild(topContainer);
                hitBar = new HitBar();
                hitBar.x = stage.stageWidth / 2 - hitBar.width /2;
                hitBar.y = 245;
                addChild(hitBar);
                downContent = new DownContent();
                addChild(downContent);
                downContent.y = 325;
                downContent.title_txt.text = "Learning Carousel";
                downContent.description_txt.text = "Click on one of images above to view further details";
                createSections();
            } ... (more functions)

  • Document class question

    just trying to understand the concept here.
    I have a flash animation '.fla' file with it's corresponding
    document class that provides the code to control it.
    I want to instantiate an instance of that document class in
    another class.
    Do I simply put the document class and it's
    corresponding'.fla' file together inside the package folder ?
    Once I declare the document class as a new object within my
    new class, how does the document class link to the it's
    corresponding .fla animation ?
    To summarize, what I am trying to do, is create a reusable
    class or component from this .fla file with its document class. I
    just dont know how to proceed.

    more than one swf can use the same document class. but
    "animation" or other timeline assets will not be shared.

  • Document Class Error

    I am working with Windows Vista Business if that makes a
    difference in this question.
    I am testing a class file for NoScale called NoScale.as
    I have created the class file attached.
    I have saved the class file in the same location as the fla
    file.
    I put in the document.class box: NoScale
    Whenever I publish, I receive the following error:
    5008: The name of definition 'Main' does not reflect the
    location of this file. Please change the definition's name inside
    this file, or rename the file.
    C:\Users\%UserName%\Desktop\Website\Reference Flas\NoScale.as
    (Note: I have replaced my username with %UserName%)
    I have attempted to put
    C:\Users\%UserName%\Desktop\Website\Reference Flas\NoScale.as into
    the document class box and I receive an error telling me that the
    \'s are incorrect and are not allowed.

    I know that the classes are code that is prewritten so you
    can use the functions within.
    The answer to your question is No, I don't know what the
    classes are doing because I am just beginning with AS3 and Flash 9.
    However, my question is Why does my code work with no
    problems without importing any of those classes into the code when
    I don't put anything into the Document class: [ box ].
    As soon as I wanted to give my flash header the ability to
    resize itself, I found out that I had to create a .as or class file
    with the above code in it to give it that capability. Once I did
    that I found out that I had to use the document class box in order
    to link that class file to the SWF. Once I created a proper .as
    file named NoScale and typed NoScale into the document class box,
    all of a sudden a ton of errors happen wanting me to include the
    flash.blah.blah files. If I remove the NoScale from the document
    class box and do nothing else, the project works just fine.
    That is what I don't understand.
    Wayne
    Adding the following did fix the errors. Thanks.
    import flash.display.LoaderInfo;
    import flash.display.InterpolationMethod;

  • How to import questions into Captivate 4 from a delimited file

    I'm looking
    a way to import questions from a delimited text file (or excel spreadsheet)
    into captivate.
    All the questions are simple multiple choice, single answer, four selections per question.
    I have hundreds - I'd hate to have to retype them all in one at a time.
    Thanks in advance
    -Joan

    Does anyone know if this is a feature in Captivate 5. 
    Other things I would really like to see in Captivate 5.
    Importing and Exporting the graded quiz/test content out of captivate into another
    application/ form.  Such as xml, tab delimited, excel spreadsheet,
    Adobe pdf, Word document or another format.  Our current content
    developement systems allows us to (when publishing) do this.
    1> exclude questions from the Published content
         (exclude section questions, or final test content)
    2> produce different test versions from question banks
    3> Produce a PDF paper test for when we want to train in a classroom setting
    4> Select which questions we want to produce
    5> Import questions from a pre-defined format.  To note: when we do this the system also makes us define a unique interaction id so that the import will update existing questions.
    I know this will NOT work for some of the more sophisticated questions, But for the simple Mulitple choice, true/false, fill in the blank.  etc..
    THIS WOULD BE A GREAT FEATURE..
    It would also be NICE TO HAVE THE abiliy to PROFILE versions of the SAME Course WITH OUT REPRODUCING / DUPLICATING / REPEATING THE  ENTIRE COURSE PRESENTATION.
    Such as
    "INSTRUCTOR TAUGHT TRAINING"
    "WEB TRAINING"
    "PAPER TEST A"
    "PAPER TEST B"
    ETC...
    LASTLY: if we can not export the QUIZ content.  Can an excel spreadsheet LIKE INTERFACE be used to edit certain aspects of the questions.
    Such as the InteractionId which is sent to the LMS ('cmi.interactions.0.id').  My developer team says it is real difficult and time consuming
    to track down interactionIds and then maintain them in a perfect way.
    Thanks,
    Doug Lubey of Louisiana
    www.douglubey.com

  • NEED TO KNOW HOW CONVERT GIF FILE TO SYMBOL FROM DOCUMENT CLASS

                                                ROBERT LEAHONG
                                      COMPUTER PROGRAMMER / ASP Web Devloper
    Hello,
            I need to convert a GIF file (PICTURE) to a symbol (Button) From within The Document Class using ActionScript 3.0 .
    Thanks in advance for your help.

    So you imported a .gif into the library and need to get to it from the document class? If that's the case you need to  right-click the image in the library, select properties, select the ActionScript tab and then set it to export for ActionScript. Give it a class name - I'll use myGif for example. You'll see it will have a base class of BitmapData...
    Then in your document class you can just instantiate it like:
    var myImageData:BitmapData = new myGif();
    You can turn it into a useable image that you can place on stage by putting it into a Bitmap object:
    var myImage:Bitmap = new Bitmap(myImageData);
    If you want to make a button out of it, ie make it clickable - stick it into a Sprite:
    var mySprite:Sprite = new Sprite():
    mySprite.addChild(myImage);
    addChild(mySprite);
    mySprite.addEventListener(MouseEvent.CLICK, clicked);
    function clicked(e:MouseEvent):void
         trace("clicked");
    HTH

  • Document Class not work when I shift my MovieClip to 2nd Frame.

    Hello,
    All my content is at 1st frame of my FLA file...and I'm using Document Class... When I try to shift my content to 2nd frame, so I can use 1st frame for preloader.. but its not working...
    This is my document class... Basically at 1st frame I'm loading external jpg image to a MovieClip..
    Is it possible, I can **** my MovieClip and other content to 2nd frame of the timeline... ??? and Document Class work???
    Thanks...
    package com.ahmad.bg
         //import all classes
         import caurina.transitions.Tweener;
         import flash.display.Loader;
         import flash.display.MovieClip;
         import flash.display.Sprite;
         import flash.display.StageAlign;
         import flash.display.StageDisplayState;
         import flash.display.StageScaleMode;
         import flash.events.Event;
         import flash.events.MouseEvent;
         import flash.net.URLRequest;
         public class MainClass extends MovieClip
              //create variables
              private var loader:Loader;
              private static const IMAGE_PATH:String = "bgs/bg.jpg";         
              public function MainClass() {
                   stage.align = StageAlign.TOP_LEFT;
                   stage.scaleMode = StageScaleMode.NO_SCALE;              
                   stage.addEventListener(Event.RESIZE, stageResize);         
                   //load external image
                   loader = new Loader();
                   loader.load(new URLRequest(IMAGE_PATH));
                   loader.contentLoaderInfo.addEventListener(Event.COMPLETE, showImage);
                   pic.addChild(loader);    
              private function showImage(e:Event):void
                   try {                             
                        e.target.content.alpha = 1;
                        Tweener.addTween(e.target.content, { alpha:1, time:1, transition:"easeOutSine" } );                   
                        e.target.content.smoothing = true;                             
                   } catch (e:Error) { };
                   stageResize();
              private function stageResize(e:Event=null):void
                   pic.x = 0;
                   pic.y = 0;
                   pic.scaleX = pic.scaleY = 1;              
                   if ((stage.stageHeight / stage.stageWidth) < pic.height / pic.width) {
                        pic.width = stage.stageWidth;
                        pic.scaleY = pic.scaleX;
                   } else {
                        pic.height = stage.stageHeight;                   
                        pic.scaleX = pic.scaleY;
                   pic.x = stage.stageWidth / 2 - pic.width / 2;
                   pic.y = stage.stageHeight / 2 - pic.height / 2;         
                   bottomNav.x = Math.floor(stage.stageWidth / 2 - bottomNav.width / 2);
                   bottomNav.y = Math.floor(stage.stageHeight - bottomNav.height - 0);

    If you have code in your main class that references specific movieclips on the stage, they have to be on every frame you plan on using.
    If you have a movieclip named "pic" on frame 2, but you are referencing it right away in the main class, which starts on frame 1, then it is looking for a movieclip that does not exist until you move it to frame 2

  • TREX does not index all documents fro document class SOLARGNSRC

    Hi all,
    I've setup a connection between a TREX server (which is also used by a portal system) and Solution Manager. I've gone through the settings in SAP Note 750623 and I was able to create a index, the queue and even bypass the basic authentication in the preprocessing for document class SOLARGNSRC
    According to everything I've read, this should be enough to be able to index all documents in Solution Manager and find them with Full Tex Search. But this doesn't work. From the 50.000 documents in de class (35.000 English and 15.000 German) only 6300 documents are passed to TREX. Most of them are German HTML links to help.sap.com. I can see in the trace files that the URL's to some documents in the content server are passed to TREX. I can open dthe document using the links but I cannot find the documents using the full text search which I think means that nothing was really indexed.
    Questions:
    1. Has anyone been able to succesfully index Solution Manager documents for full text search purposes?
    2. Why are only 10% of the documents passed to TREX? Is there a specific setting for this?
    3. Why does TREX use the Content Server HTTP links to index the documents and not the RFC connection?
    Cheers
    Marcel Rabe

    Yep, all lights green
    SSR maintained. DRFUZZY as Search Engine (I have not tried Verity)
    Return Code? Interesting, I don't get an return code when I trigger the Index/Deindex. I just see the hourglass for about 5 minutes (when I run it in the foreground) and after that its back to the way it was. No messages. Nothing appears in the application logs as far as I can see.
    The program RSTIRIDX  is scheduled in the background and runs every hour minutes for about 10 seconds without an error.
    TREX Version 7.00.39.00
    Five languages actived, including German and English. In SKPR07 under Indexed documents I can see that 300 German and 6000 English documents have status indexed.
    No proxy server. Systems sit within the same network segment
    Thnx for your help. I posted a message with SAP as well as this seems strange to me.
    Marcel

  • Document Class vs Timeline code differences...

    I'm trying to hunt down some kind of class conflict I seem to be having when using TweeLite easing and found out the same code that errors in a document class works fine if I place it in the timeline.
    Example - this works in frame one of the timeline:
    import com.greensock.TweenLite;
    import com.greensock.easing.*;
    TweenLite.to(obj, 1, { x:200, ease:Bounce.easeOut } );
    If however I make a very simple document class like so:
    package
          import com.greensock.TweenLite;
          import com.greensock.easing.*;
          import flash.display.MovieClip;
          public class Main extends MovieClip
               public function Main()
                    TweenLite.to(obj, 1, { x:200, ease:Bounce.easeOut } );
    I get an error when compiling:
    1119: Access of possibly undefined property easeOut through a reference with static type Class.
    So what's the differences between using a document class and timeline code?

    Odd... seems to have been a caching issue. I renamed the class, rebooted, and deleted ASO files and now it's working. Funny thing is that I never need to delete ASO files before... any thoughts on why this would stay cached?
    And, after rebooting I can make changes and don't need to delete ASO files either.
    Thanks!

  • Preloader in Document Class Help.

    Hello,
    I want to know that how can I add a Preloader to my existing document class. In my FLA all content is on 1st Frame. I'm loading an external image to a MovieClip which is on 1st frame and on stage. My document class is working fine but when i try to add any preloading script, its not working...
    Can any one please help me in this regard..
    A Garden of Thanks.
    My Document Class is here...  (This was also a tutorial which I'm using..)
    package com.ahmad.bg
         //import all classes
         import caurina.transitions.Tweener;
         import flash.display.Loader;
         import flash.display.MovieClip;
         import flash.display.Sprite;
         import flash.display.StageAlign;
         import flash.display.StageDisplayState;
         import flash.display.StageScaleMode;
         import flash.events.Event;
         import flash.events.MouseEvent;
         import flash.net.URLRequest;
         public class MainClass extends MovieClip
              //create variables
              private var loader:Loader;
              private static const IMAGE_PATH:String = "bgs/bg.jpg";          
              public function MainClass() {
                   stage.align = StageAlign.TOP_LEFT;
                   stage.scaleMode = StageScaleMode.NO_SCALE;               
                   stage.addEventListener(Event.RESIZE, stageResize);          
                   //load external image
                   loader = new Loader();
                   loader.load(new URLRequest(IMAGE_PATH));
                   loader.contentLoaderInfo.addEventListener(Event.COMPLETE, showImage);
                   pic.addChild(loader);     
              private function showImage(e:Event):void
                   try {                              
                        e.target.content.alpha = 0;
                        Tweener.addTween(e.target.content, { alpha:1, time:1, transition:"easeOutSine" } );                    
                        e.target.content.smoothing = true;                              
                   } catch (e:Error) { };
                   stageResize();
              private function stageResize(e:Event=null):void
                   pic.x = 0;
                   pic.y = 0;
                   pic.scaleX = pic.scaleY = 1;               
                   if ((stage.stageHeight / stage.stageWidth) < pic.height / pic.width) {
                        pic.width = stage.stageWidth;
                        pic.scaleY = pic.scaleX;
                   } else {
                        pic.height = stage.stageHeight;                    
                        pic.scaleX = pic.scaleY;
                   pic.x = stage.stageWidth / 2 - pic.width / 2;
                   pic.y = stage.stageHeight / 2 - pic.height / 2;          
                   //my bottom navigation
                            bottomNav.x = Math.floor(stage.stageWidth / 2 - bottomNav.width / 2);
                   bottomNav.y = Math.floor(stage.stageHeight - bottomNav.height - 0);

    package com.ahmad.bg
         //import all classes
         import caurina.transitions.Tweener;
         import flash.display.Loader;
         import flash.display.MovieClip;
         import flash.display.Sprite;
         import flash.display.StageAlign;
         import flash.display.StageDisplayState;
         import flash.display.StageScaleMode;
         import flash.events.Event;
         import flash.events.MouseEvent;
         import flash.net.URLRequest;
         import flash.events.ProgressEvent;
         public class MainClass extends MovieClip
              //create variables
              private var loader:Loader;
              private static const IMAGE_PATH:String = "bgs/bg.jpg";          
              public function MainClass() {
                   stage.align = StageAlign.TOP_LEFT;
                   stage.scaleMode = StageScaleMode.NO_SCALE;               
                   stage.addEventListener(Event.RESIZE, stageResize);          
                   //load external image
                   loader = new Loader();
                   loader.load(new URLRequest(IMAGE_PATH));
                   loader.contentLoaderInfo.addEventListener(Event.COMPLETE, showImage);
                   loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, preload_image, false, 0, true);
                   private function preload_image(event:ProgressEvent):void
                          var per = int((event.bytesLoaded / event.bytesTotal) * 100);
                          pic.addChild(loader);
                          //make a textfield or preloader animation and assign this per to it.
              private function showImage(e:Event):void
                   try {                              
                        e.target.content.alpha = 0;
                        Tweener.addTween(e.target.content, { alpha:1, time:1, transition:"easeOutSine" } );                    
                        e.target.content.smoothing = true;                              
                   } catch (e:Error) { };
                   stageResize();
              private function stageResize(e:Event=null):void
                   pic.x = 0;
                   pic.y = 0;
                   pic.scaleX = pic.scaleY = 1;               
                   if ((stage.stageHeight / stage.stageWidth) < pic.height / pic.width) {
                        pic.width = stage.stageWidth;
                        pic.scaleY = pic.scaleX;
                   } else {
                        pic.height = stage.stageHeight;                    
                        pic.scaleX = pic.scaleY;
                   pic.x = stage.stageWidth / 2 - pic.width / 2;
                   pic.y = stage.stageHeight / 2 - pic.height / 2;          
                   //my bottom navigation
                   bottomNav.x = Math.floor(stage.stageWidth / 2 - bottomNav.width / 2);
                   bottomNav.y = Math.floor(stage.stageHeight - bottomNav.height - 0);
    Oh.. Thanks.. its working now... Thanks aloooooooooooooot.....
    Any other tip if you have a time to give me will be a greatful to you...
    Thanks again for your precious time.. I've seen your Awesome Portfolio at your website....

  • Accessing value in document class

    hello i am trying to acces a value in the document class. but i can't get it to work.
    what i have is:
    can someone tell me how i should access the myArray value?
    bomberman.as:
    package  {
              import flash.display.MovieClip;
              public class bomberman extends MovieClip {
            public var myArray:Array=[]; //trying to access this value
                        public function bomberman() {
                                  init();
                                  //trace(document.docClass);
                        private function init() {
                        var square:Array=[];
                                  for (var i:Number=0;i<11;i++) {
                                            for (var j:Number=0;j<11;j++) {
                                                      var temp:grassSquare;
                                                      if (i==0||i==10) {
                                                                temp=new grassSquare(i*50,j*40);
                                                                addChild(temp);
                                                                square.push(temp);
                                                      } else if (i%2!=0) {
                                                                if (j==0||j==10) {
                                                                          temp=new grassSquare(i*50,j*40);
                                                                          addChild(temp);
                                                                          square.push(temp);
                                                                          myArray.push(false);
                                                                } else {
                                                                          myArray.push(true);
                                                      } else {
                                                                if (j%2==0) {
                                                                          temp=new grassSquare(i*50,j*40);
                                                                          addChild(temp);
                                                                          square.push(temp);
                                                                          myArray.push(false);
                                                                } else {
                                                                          myArray.push(true);
    bomberman.fla:
    import flash.events.KeyboardEvent
              var User1:Player1=new Player1;
              stage.addEventListener(KeyboardEvent.KEY_DOWN, User1.fl_SetKeyPressed);
              User1.x=75;
              User1.y=60;
              addChild(User1);
    Player1.as:
    package  {
              import flash.display.MovieClip;
              import flash.events.Event;
              import flash.events.KeyboardEvent
              import flash.ui.Keyboard
              public class Player1 extends MovieClip {
              private var upPressed:Boolean = false;
              private var downPressed:Boolean = false;
              private var leftPressed:Boolean = false;
              private var rightPressed:Boolean = false;
              private var currentSquare:uint=12;
                        public function Player1() {
                                  this.addEventListener(Event.ENTER_FRAME, fl_MoveInDirectionOfKey);
                                  //stage.addEventListener(KeyboardEvent.KEY_DOWN, fl_SetKeyPressed);
                        public function fl_MoveInDirectionOfKey(event:Event)
                                            if (upPressed && this.y>=100 /*&&document.myArray[currentSquare-1]*/)
                                                      this.y -= 40;
                                                      upPressed = false;
                                                      currentSquare-=1;
                                            if (downPressed && this.y<=340 /*&& this.myArray[currentSquare+1]*/)
                                                      this.y += 40;
                                                      downPressed = false;
                                                      currentSquare+=1;
                                            if (leftPressed && this.x>=125 /*&& /*this.myArray[currentSquare-11]*/)
                                                      this.x -= 50;
                                                      leftPressed = false;
                                                      currentSquare-=11;
                                            if (rightPressed && this.x<=425 /* && /*this.myArray[currentSquare+11]*/)
                                                      this.x += 50;
                                                      rightPressed = false;
                                                      currentSquare+=11;
                                            trace(currentSquare);
                                  public function fl_SetKeyPressed(event:KeyboardEvent):void
                                            switch (event.keyCode)
                                                      case Keyboard.UP:
                                                                upPressed = true;
                                                                break;
                                                      case Keyboard.DOWN:
                                                                downPressed = true;
                                                                break;
                                                      case Keyboard.LEFT:
                                                                leftPressed = true;
                                                                break;
                                                      case Keyboard.RIGHT:
                                                                rightPressed = true;
                                                                break;

    i have this code now and it gives me a bunch of errors. could someone tell me what's going wrong ?
    errors are in the red code.
    C:\Users\Jannes\Desktop\dev\Player1.as, Line 25
    1093: Syntax error.
    C:\Users\Jannes\Desktop\dev\Player1.as, Line 27
    1084: Syntax error: expecting identifier before this.
    C:\Users\Jannes\Desktop\dev\Player1.as, Line 27
    1084: Syntax error: expecting colon before minusassign.
    C:\Users\Jannes\Desktop\dev\Player1.as, Line 28
    1084: Syntax error: expecting rightbrace before semicolon.
    C:\Users\Jannes\Desktop\dev\Player1.as, Line 31
    1084: Syntax error: expecting rightparen before if.
    C:\Users\Jannes\Desktop\dev\Player1.as, Line 31
    1084: Syntax error: expecting identifier before dot.
    C:\Users\Jannes\Desktop\dev\Player1.as, Line 31
    1093: Syntax error.
    C:\Users\Jannes\Desktop\dev\Player1.as, Line 33
    1084: Syntax error: expecting identifier before this.
    C:\Users\Jannes\Desktop\dev\Player1.as, Line 33
    1084: Syntax error: expecting colon before plusassign.
    C:\Users\Jannes\Desktop\dev\Player1.as, Line 34
    1084: Syntax error: expecting rightbrace before semicolon.
    C:\Users\Jannes\Desktop\dev\Player1.as, Line 37
    1093: Syntax error.
    C:\Users\Jannes\Desktop\dev\Player1.as, Line 39
    1084: Syntax error: expecting identifier before this.
    C:\Users\Jannes\Desktop\dev\Player1.as, Line 39
    1084: Syntax error: expecting colon before minusassign.
    C:\Users\Jannes\Desktop\dev\Player1.as, Line 40
    1084: Syntax error: expecting rightbrace before semicolon.
    C:\Users\Jannes\Desktop\dev\Player1.as, Line 43
    1084: Syntax error: expecting rightparen before if.
    C:\Users\Jannes\Desktop\dev\Player1.as, Line 43
    1084: Syntax error: expecting identifier before dot.
    C:\Users\Jannes\Desktop\dev\Player1.as, Line 43
    1093: Syntax error.
    C:\Users\Jannes\Desktop\dev\Player1.as, Line 45
    1084: Syntax error: expecting identifier before this.
    C:\Users\Jannes\Desktop\dev\Player1.as, Line 45
    1084: Syntax error: expecting colon before plusassign.
    C:\Users\Jannes\Desktop\dev\Player1.as, Line 46
    1084: Syntax error: expecting rightbrace before semicolon.
    package  {
              import flash.display.MovieClip;
              import flash.events.Event;
              import flash.events.KeyboardEvent
              import flash.ui.Keyboard
              public class Player1 extends MovieClip {
              private var upPressed:Boolean = false;
              private var downPressed:Boolean = false;
              private var leftPressed:Boolean = false;
              private var rightPressed:Boolean = false;
              private var currentSquare:uint=12;
                        public function Player1() {
                                  this.addEventListener(Event.ENTER_FRAME, fl_MoveInDirectionOfKey);
                                  //stage.addEventListener(KeyboardEvent.KEY_DOWN, fl_SetKeyPressed);
                        public function fl_MoveInDirectionOfKey(event:Event)
                                            if (upPressed && this.y>=100 && MovieClip(root).myArray[currentSquare-1]*/)
                                                      this.y -= 40;
                                                      upPressed = false;
                                                      currentSquare-=1;
                                            if (downPressed && this.y<=340 && MovieClip(root).myArray[currentSquare+1]*/)
                                                      this.y += 40;
                                                      downPressed = false;
                                                      currentSquare+=1;
                                            if (leftPressed && this.x>=125 && MovieClip(root).myArray[currentSquare-11]*/)
                                                      this.x -= 50;
                                                      leftPressed = false;
                                                      currentSquare-=11;
                                            if (rightPressed && this.x<=425 && MovieClip(root).myArray[currentSquare+11]*/)
                                                      this.x += 50;
                                                      rightPressed = false;
                                                      currentSquare+=11;
                                            trace(currentSquare);
                                  public function fl_SetKeyPressed(event:KeyboardEvent):void
                                            switch (event.keyCode)
                                                      case Keyboard.UP:
                                                                upPressed = true;
                                                                break;
                                                      case Keyboard.DOWN:
                                                                downPressed = true;
                                                                break;
                                                      case Keyboard.LEFT:
                                                                leftPressed = true;
                                                                break;
                                                      case Keyboard.RIGHT:
                                                                rightPressed = true;
                                                                break;

Maybe you are looking for