How do you call two actionscript files in another as3

My problem is that i what to call two actionscript files in another one, but cant do it.
This is are the two codes i want to play at the same time in my scene:
Code 1
* Inventory System Manager
* DATE: 07/24/2010
* AS3
* UPDATES AND DOCUMENTATION AT: http://www.FreeActionScript.com
package 
    import flash.display.Sprite;
    import com.freeactionscript.inventorySystem.InventorySystem;
    public class Main extends Sprite
        private var _inventorySystem:InventorySystem;
        public function Main()
            //InventorySystem(reference to stage in the fla)
            _inventorySystem = new InventorySystem(this);
Code 2
* Player Movement - 8-way keyboard
* VERSION: 1.0
* DATE: 9/23/2010
* AS3
* UPDATES AND DOCUMENTATION AT: http://www.FreeActionScript.com
package 
    import flash.display.MovieClip;
    import flash.events.Event;
    import flash.events.KeyboardEvent;
    import flash.ui.Keyboard;
    public class Main extends MovieClip
        // player
        private var _player:MovieClip;
        // player settings
        private var _playerSpeed:Number = 4;
        // movement flags
        private var _movingUp:Boolean = false;
        private var _movingDown:Boolean = false;
        private var _movingLeft:Boolean = false;
        private var _movingRight:Boolean = false;
         * Constructor
        public function Main()
            createPlayer();
            // add listeners
            stage.addEventListener(Event.ENTER_FRAME, enterFrameHandler);           
            stage.addEventListener(KeyboardEvent.KEY_DOWN, myOnPress);
            stage.addEventListener(KeyboardEvent.KEY_UP, myOnRelease);
         * Creates player
        private function createPlayer():void
            _player = new Player();
            _player.x = stage.stageWidth / 2;
            _player.y = stage.stageHeight / 2;
            stage.addChild(_player);
         * EnterFrame Handlers
        private function enterFrameHandler(event:Event):void
            // Move up, down, left, or right
            if ( _movingLeft && !_movingRight )
                _player.x -= _playerSpeed;
                _player.rotation = 270;
            if ( _movingRight && !_movingLeft )
                _player.x += _playerSpeed;
                _player.rotation = 90;
            if ( _movingUp && !_movingDown )
                _player.y -= _playerSpeed;
                _player.rotation = 0;
            if ( _movingDown && !_movingUp )
                _player.y += _playerSpeed;
                _player.rotation = 180;
            // Move diagonally
            if ( _movingLeft && _movingUp && !_movingRight && !_movingDown )
                _player.rotation = 315;
            if ( _movingRight && _movingUp && !_movingLeft && !_movingDown )
                _player.rotation = 45;
            if ( _movingLeft && _movingDown && !_movingRight && !_movingUp )
                _player.rotation = 225;
            if ( _movingRight && _movingDown && !_movingLeft && !_movingUp )
                _player.rotation = 135;
            //i will do
            if (_player.x > 550)
                _player.x = 550;
                _player.x = +_player.x;
            else if (_player.x < 50)
                _player.x = 50;
                _player.x = +_player.x;
            if (_player.y > 350)
                _player.y = 350;
                _player.y = +_player.y;
            else if (_player.y < 50)
                _player.y = 50;
                _player.y = +_player.y;
            trace ("Valor en x: " + _player.x);
            trace ("Valor en y: " + _player.y);
         * Key Press Handlers
        public function myOnPress(event:KeyboardEvent):void
            switch( event.keyCode )
                case Keyboard.UP:
                    _movingUp = true;
                    break;
                case Keyboard.DOWN:
                    _movingDown = true;
                    break;
                case Keyboard.LEFT:
                    _movingLeft = true;
                    break;
                case Keyboard.RIGHT:
                    _movingRight = true;
                    break;
         * Key Release Handlers
        public function myOnRelease(event:KeyboardEvent):void
            switch( event.keyCode )
                case Keyboard.UP:
                    _movingUp = false;
                    break;
                case Keyboard.DOWN:
                    _movingDown = false;
                    break;
                case Keyboard.LEFT:
                    _movingLeft = false;
                    break;
                case Keyboard.RIGHT:
                    _movingRight = false;
                    break;
Hope you help me =)

You need to have a reference to an instance of one class in the other class or the other way round in order to communicate between the two. Alternatively you can call a static function of one class from an instance of the other class.
Anyway, I suggest reading about object-oriented programming first (can be even a Java book) to understand how things work. Such basics really help and it's never shame to read it.
Good luck

Similar Messages

  • How do you open a DVD/file in another search engine

    how do you open a DVD/file in another search engine?

    Hi
    I think it is simpler than that: place DVD in computer and then try to run a video from the disk. It will not run using Safari, but I know it runs in Firefox which I have on the computer.
    I believe that I can depress one of the moifier keys while clicking an item on the application menu bar to open a menu where you can open the dvd using Firefox or another application.
    Should be simple, but yet to find solution.

  • How do I call two csv files into ews?

    I have to call two csv files into a script with ews:
    Param([string]$calInputFile = "C:\Algemene agenda\Data docenten.txt" )
    Param([string]$calMailboxFile ="C:\Algemene agenda\Alle docenten.txt"
    # Load all Entries
    $calagenda = Import-Csv $calInputFile
    $calMailbox = Import-Csv $callMailboxfile
    This do not work.
    How can I do this???

    OH!!  Why didn't I see this before?  s-:  You are having problems with the Param definition, but it appears you are having troubles pulling the data into the script.  You can only have a single Param definition for a script.  Try
    the following instead:
    Param(
        [string]$calInputFile
    = "C:\Algemene agenda\Data docenten.txt",
        [string]$calMailboxFile
    ="C:\Algemene agenda\Alle docenten.txt"
    ## Load all Entries
    $calagenda = Import-Csv $calInputFile
    $calMailbox = Import-Csv $callMailboxfile
    To define multiple parameters, you have your Param definition (with its parentheses) and all parameters are defined inside it, separated by commas.

  • How do you link two Indesign Files

    I am creating an IPad App in InDesign, made up of 8 different InDesign Files. eg Wedding.indd, Travel.indd, Pricing.indd, Home.indd, etc.
    My aim is to link the Home Page to each of the other pages so that when a user taps  for example Wedding on the Home page it will take them to the Wedding Page and so on.
    I have used go to page with no luck and go to file again with no luck, can anyone out there help with this please?
    Thanking you in advance
    Barb

    See https://helpx.adobe.com/digital-publishing-suite/help/hyperlink-overlays.html#create_links _to_other_articles for instructions on how to do this.
    Neil

  • How do you incorporate a .SQL file in another script?

    I have a SELECT statement in a file that cannot be altered and must be run as it is sent to me. I am creating another table using this SELECT statement. I just want to run my own script which gets part of its content from the one sent me. That way, if the - you might call it 'sub script' changes, I won't have to change anything. It goes something like the following, though this is greatly changed and simplified.
    But I want to read everything in the block from a separate file rather than have it copied and pasted every time as it is now. Thank you.
    select e.emp_ID
    ,e.data1
    ,e.data2,
    from empdata e
         BEGINNING OF THE MAIN REPORT (this is pasted
    from other suq-query at the present moment)
    select distinct w.emp_ID, w.empwages
    from wages w
         END OF THE MAIN QUERY
    ) main
    WHERE
    main.wages > 40

    Another way to read OS file data in SQL is using External Tables.
    Random example (there are more in the documentation):
    CREATE TABLE test_external
    ( id   NUMBER(8)
    , col1 VARCHAR2(20) )
    ORGANIZATION EXTERNAL
    ( TYPE oracle_loader
      DEFAULT DIRECTORY william_data
      ACCESS PARAMETERS
      ( RECORDS DELIMITED BY newline
        LOGFILE 'test_external.log'
        FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
        ( id
        , col1 )
      LOCATION ('test_ext2.dat','test_ext1.dat')
    );The OS file directory is specified indirectly. Rather than putting '/somewhere/data' in the table creation command, you create a directory object using
    CREATE DIRECTORY william_data AS '/somewhere/data';Notice you can specify more than one data filename (you'll probably only need one). You can also change this attribute with ALTER TABLE.
    Notice the line "TYPE oracle_loader" - the ORACLE_LOADER access driver is documented here (there is also an "ORACLE_DATAPUMP", which you don't want).
    Once set up, you just query the table and it reads the file.

  • Novice: How do you manually "move" one file above another file

    Hi,
    Sorry if this a FAQ, I'm an iTunes novice.
    I have a series of MP3s that need to stay/be played in sequence. Changing/renaming them will be a royal pain.
    The filenames are numeric, e.g.:
    1009x09
    1009x10
    1011x11
    The problem I have as I'm "Importing" them from the original MP3 CDs is that the file named "1010x10" keeps getting appended to the bottom of the list, rather than staying in sequence. This (so far) is the only file this is happening to.
    How can I "force it/move it" to stay in sequence?
    Thanks,
    Mike

    First, put them in a playlist.
    Make sure there is a little triangle in the space at the top of the number column. If not, click that spot to get the triangle.
    Now just grab any track you want and move it (by click and drag) up or down to where you want.

  • Calling an xsl file in another

    Hi,
    I have 2 xsl files
    nested_flow.xsl
    and substring_flow.xsl.
    my query is how can i call 1 xsl file in another.
    i need to perform a mapping whixh is actually present in the other file(substring_flow.xsl)
    im calling substring_flow.xsl in nested_flow.xsl
    so i'm using
    <xsl:include href="substring_flow.xsl"/>
    when i use it in xi it gives me an error.
    Is there any other way by means of which i can call one xsl in another.
    <u>nested_flow.xsl:</u>
    <?xml version="1.0" encoding="UTF-8" ?>
    - <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="urn:Testns" xmlns:javamap="java:com.satyam.Javaclass">
    <xsl:include href="substring_flow.xsl" />
    - <xsl:template match="/">
    - <substring_node_input>
    - <InputString>
    <xsl:value-of select="ns0:nested_node_input/Person/LName" />
    </InputString>
    </substring_node_input>
    - <nested_node_output>
    - <Emp>
    - <Innitial>
    <xsl:value-of select="ns0:substring_node_output/OutputString" />
    </Innitial>
    </Emp>
    </nested_node_output>
    </xsl:template>
    </xsl:stylesheet>
    <u>substring_flow.xsl:</u>
    <?xml version="1.0" encoding="UTF-8" ?>
    - <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="urn:Testns" xmlns:javamap="java:com.satyam.Javaclass">
    - <xsl:template match="/">
    - <substring_node_output>
    - <OutputString>
    <xsl:value-of select="substring(ns0:substring_node_input/InputString,0,1)" />
    </OutputString>
    </substring_node_output>
    </xsl:template>
    </xsl:stylesheet>

    Hi,
    I have 2 xsl files
    nested_flow.xsl
    and substring_flow.xsl.
    my query is how can i call 1 xsl file in another.
    i need to perform a mapping whixh is actually present in the other file(substring_flow.xsl)
    im calling substring_flow.xsl in nested_flow.xsl
    so i'm using
    <xsl:include href="substring_flow.xsl"/>
    when i use it in xi it gives me an error.
    Is there any other way by means of which i can call one xsl in another.
    <u>nested_flow.xsl:</u>
    <?xml version="1.0" encoding="UTF-8" ?>
    - <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="urn:Testns" xmlns:javamap="java:com.satyam.Javaclass">
    <xsl:include href="substring_flow.xsl" />
    - <xsl:template match="/">
    - <substring_node_input>
    - <InputString>
    <xsl:value-of select="ns0:nested_node_input/Person/LName" />
    </InputString>
    </substring_node_input>
    - <nested_node_output>
    - <Emp>
    - <Innitial>
    <xsl:value-of select="ns0:substring_node_output/OutputString" />
    </Innitial>
    </Emp>
    </nested_node_output>
    </xsl:template>
    </xsl:stylesheet>
    <u>substring_flow.xsl:</u>
    <?xml version="1.0" encoding="UTF-8" ?>
    - <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="urn:Testns" xmlns:javamap="java:com.satyam.Javaclass">
    - <xsl:template match="/">
    - <substring_node_output>
    - <OutputString>
    <xsl:value-of select="substring(ns0:substring_node_input/InputString,0,1)" />
    </OutputString>
    </substring_node_output>
    </xsl:template>
    </xsl:stylesheet>

  • How can you tell if a file is being used in your project or not?

    How can you tell if a file in your bin is being used in your project or not? My director dragged hundreds of reference files into my project and only used a few of them. I'd like to do some house cleaning and delete the ones that are not in use. This project file has 100 sequences in it, so it would be a tough manual hunt to figure this out.
    In Premiere Pro (or Flash for example), where all the information is in the Project Bin such as in/out times and duration, there is where it tells you how many times that piece of media has been used or if it hasn't been used yet.
    Can FCP tell me this info?
    Thanks for yout time!
    -Monty

    Monty,
    Within FCP, there is a menu item called "Media Manager" (depending on what version you are in). This would be worth your while to look into. It basically organizes your project by moving/archiving any used assets of a project and leaving out un-used assets. It saves a ton of disk space.
    For example, say you have a 5 minute clip with an in/out point that is just 30 seconds. Media Manager will "archive" just that 30 seconds, not the entire clip. There is even a setting that you can add additional "handles" time to the front andd back of the clip if you think you may need to add or change transition.
    Do a google search. I was just watching a few Youtube videos on this myself.
    Jonathan

  • How to execute/call a cfm file in an Oracle stored proc?

    Hello everyone! I'm quite new to Oracle PL/SQL stored
    procedure. Is it possible and how do you call/execute a coldfusion
    file from an Oracle stored procedure? I know that cfm files can
    call stored procedures. How about the other way around? Any ideas
    or suggestions is much appreciated. Thanks..

    I'm having a hard time trying to think of why you would
    actually want to do something like that. However, all that aside,
    the short answer is no. The database has no real "knowledge" about
    ColdFusion, and there is no way for PL/SQL to "execute" anything on
    the ColdFusion server. Maybe if you were more specific as to what
    you were actually trying to do rather than such a generic question,
    someone might be able to help you find an alternative.
    Phil

  • How do you call a java class from the main method in another class?

    Hi all,
    How do you call a java class from the main() method in another class? Assuming the two class are in the same package.
    Thanks
    SI
    Edited by: okun on May 16, 2010 8:40 PM
    Edited by: okun on May 16, 2010 8:41 PM
    Edited by: okun on May 16, 2010 8:47 PM

    georgemc wrote:
    To answer your impending question, either the method you're calling has to be static, or you need an instance of that other class to invoke it against. Prefer the latterAnd to your impending question after that: no, don't use the Singleton pattern.

  • How do i play two sound file one after another

    Hi All,
    How do i play two sound file one after another using single AudioClip Component?.
    Advance in thanks
    Manivel

    AudioClip gives you very little control over what happens to the sound, it also isn't capable of playing long clips or waiting until a clip ends. It will play multiple clips over top of each other.
    To do what you want you should use the facilities of javax.sound. Here's a post with an example: http://forum.java.sun.com/thread.jspa?forumID=513&threadID=450768
    There is also a tutorial, but its example fails for long clips.

  • HT3825 so how do you convert the raw files to jpeg in iphoto?

    how do you convert the raw files to jpeg in iphoto?

    Many thanks Barbara and dj_paige.
    What I didn't mention is that I'm using PSE 5 with ACR 4.6, if its relevant.  I'm thinking of updating to the next version when its out in the hope that it will run with Windows 7 64 bit or I may go to Lightroom.
    I can now see that I can batch convert a whole folder of files using "process multiple files" as dj_paige suggested but that is too many at once as the settings I choose won't be relevant for all the pics in the folder. 
    I was hoping to batch convert say 5 or 6 similar photos at a time with the same settings. I'm not quite clear what you're suggesting but I'm hoping that its a "work round" using two stages to achieve this. 
    I can't see a list of open files within ACR to ensure that they are all selected as you suggest. 
    What does clicking Open rather than Done mean?  Does this amend the original RAW file to the settings selected so that if I then "process multiple files" on the whole folder to convert from RAW to JPEG they will in fact have already been processed in smaller groups so I can convert without applying any further changes?
    If so, what settings should I apply to "process multiple files" to ensure a simple conversion of file type rather than any further adjustments?
    Any further help on this would be much appreciated.
    Andrew

  • How do you create two seperate calendars in ICalendar?

    How do you create two seperate viewing calendars in Icalendar?

    Hi,
    To make a new calendar, select File > New Calendar...
    To view/hide a calendar check/uncheck the checkbox next to it in the calendar list. From memory: in OSX 10.7 select the 'Calendars' button in the top left of the window to see the calendar list.
    Best wishes
    John M

  • How do you call 0900 numbers on iphone?

    how do you call 0900 numbers on iphone? it keeps saying that i cant call it- is there a code or anything?
    im on vodafone
    thanks

    thanks for the advice both
    ive noticed though that sometimes companies provide a cheaper alternative to an 0900 number as in 8***** or something - if this makes any sense? but even those numbers are still blocked???

  • How do you connect two Apple ID's?

    How do you connect two Apple ID's to one another?

    Yes. You can sync multipl iDevices on the same computer using the same Apple ID. You can each have different configurations of apps, books, music, etc. or have identical configurations. In this way, however, your common data - contacts, mail, calendar will be the same on both iDevices.
    The Apple ID doesn't distinguish one phone from another, only how the phone will sync to a computer. The Apple ID is how iTunes knows to which computer a phone syncs. And, the Apple ID determines who is the registered owner of downloaded and purchased items via iTunes.

Maybe you are looking for

  • How do you share Aperture file across multiple users on same Mac?

    How do you share Aperture file across multiple users on same Mac? Seems this should be a preferences choice.

  • I am unable to wrap text around image.

    I have posted one typical page on our website with one photo, a main heading and some text.  I have struggled for several days, trying to wrap the text around the photo and allow some space between the photo and the text.  I have studied numerous boo

  • Error in sxmb_moni  :  message scheduled

    hi,    in sxmb_moni , i get the status messasage "scheduled". my queue status is "message waiting in queue". my receiver field is empty.       can somebody help me to solve this problem. thanks in advance,       disney

  • Error in Sending spool list in background !!!

    Hello Gurus, I am trying to create a distribution list and as a requirement have to send the spool list out of the batch job to different users. I have created in SPAD a device type POST2 and specified the spool server. In Access method I have put HO

  • Adobe form adding condition to subform

    I have added an image to a subform and I would like to display that image if certain condition is true. I added following code ing "readOnly" but its not working if ($record.............................. <= "1000") then this.presence = "visible" else