A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: problem with "#include"

  1. #1
    Junior Member
    Join Date
    Jul 2003
    Posts
    29

    problem with "#include"

    I'm trying to make a flash game where people write small files, and they get included into the game.

    However, I need to use #include with a variable, but it won't let me (malformed). I need it to be a variable so the user can choose the file to be included.

    Anyways, how can I get around this? I need it so it will import the script and use it, if theres another way I'll be happy to hear.

    Also, I'm using MX.
    Last edited by Hexagon_Clock; 10-01-2004 at 10:53 AM.

  2. #2
    Senior Member
    Join Date
    Jul 2004
    Location
    In a box outside of Safeway
    Posts
    201
    I don't personally recommend using #include, I like to use loadVar(); Do a google search on loadVar() and I'm sure you will be pleased.
    If computer games affected us, would I not be running into walls popping strange yellow pills and listening to repetitive music?

  3. #3
    Junior Member
    Join Date
    Jul 2003
    Posts
    29
    Originally posted by frozenfire89
    I don't personally recommend using #include, I like to use loadVar(); Do a google search on loadVar() and I'm sure you will be pleased.
    Will it load actionscript?

  4. #4
    Senior Member jbum's Avatar
    Join Date
    Feb 2004
    Location
    Los Angeles
    Posts
    2,920
    #include is intended to provide flash developers with a way to reuse code among multiple projects. It is a preprocessor command, meaning the code has already been included when you publish your SWF file - as far as your SWF file is concerned, there are no #includes - just code.

    There is no way to dynamically load and compile actionscript - the compilation is performed by the Flash authoring software, not the player. You can dynamically load other SWFs however, using loadMovie().

    - Jim

  5. #5
    Senior Member
    Join Date
    Jul 2004
    Location
    In a box outside of Safeway
    Posts
    201
    I recommend you pre-define the a bunch of functions, and make it so that a user can use different identifiers to activate these functions.
    If computer games affected us, would I not be running into walls popping strange yellow pills and listening to repetitive music?

  6. #6
    Junior Member
    Join Date
    Jul 2002
    Posts
    8
    Thanks a million jbum (from the future: 2009)

    You saved my butt a ton of work. I was about to totally give up on #includes until you explained how they aren't loaded as an "external file" but instead are "compiled in" the .swf file during the "Publish" or "Test Movie".

    I never in a thousand years would have figured that out.

    You are the hero of 2009


    Quote Originally Posted by jbum View Post
    #include is intended to provide flash developers with a way to reuse code among multiple projects. It is a preprocessor command, meaning the code has already been included when you publish your SWF file - as far as your SWF file is concerned, there are no #includes - just code.

    There is no way to dynamically load and compile actionscript - the compilation is performed by the Flash authoring software, not the player. You can dynamically load other SWFs however, using loadMovie().

    - Jim
    raja

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center