Jump to content



Welcome to AstaHost - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!

Toggle shoutbox Shoutbox Open the Shoutbox in a popup

@  yordan : (19 June 2013 - 02:28 PM) Long Life To Asta New Era
@  agyat : (19 June 2013 - 01:58 PM) New Era Start At Asta Or Asta Start In New Era. :unsure:
@  yordan : (16 June 2013 - 05:41 PM) You're Welcome, Agyat!
@  agyat : (16 June 2013 - 07:38 AM) Thanks Yordan...
@  velma : (16 June 2013 - 12:06 AM) I Have Asked Opa To Check For A Backup.. He'll Let Me Know Soon :)
@  velma : (16 June 2013 - 12:05 AM) T_T It Seems That Someone Has Deleted That Topic Since I Found The Url Of The Topic But It Gives Me An Error
@  yordan : (15 June 2013 - 10:31 PM) @velma : It's A Tuto On How To Create A Login Program.
@  yordan : (15 June 2013 - 10:31 PM) Happy Birthday To Youuuuuu Agyat!
@  yordan : (15 June 2013 - 10:31 PM) Ba$
@  agyat : (15 June 2013 - 04:41 PM) :(
@  agyat : (15 June 2013 - 04:41 PM) Where The Hall I Were? 15Th Is Almost At End And No-One Wished Me "happy Birthday"!!!
@  velma : (14 June 2013 - 10:39 AM) Which Tutorial Is He Searching For?
@  velma : (14 June 2013 - 10:38 AM) Which Tutorial Is He Searching For?
@  yordan : (14 June 2013 - 07:47 AM) Ok, Have A Look Tomorrow.
@  yordan : (13 June 2013 - 03:19 PM) @velma, Can You Have A Look At Feelay's Problem? Seems That His Tutorial Is Not Searchable Today.
@  Feelay : (13 June 2013 - 08:11 AM) Oh, Haha
@  velma : (12 June 2013 - 05:39 PM) T_T Lately My Levels Of Procrastination..... **sigh**
@  velma : (12 June 2013 - 05:38 PM) I'll Do It Later
@  velma : (12 June 2013 - 05:38 PM) Procrastinators.. People Who Keep Saying "i'll Do This In A Bit"
@  Feelay : (12 June 2013 - 02:05 PM) Deal Punishments To What?

Photo
- - - - -

Loading External Actionscript


10 replies to this topic

#1 demolaynyc

demolaynyc

    Premium Member

  • Members
  • 330 posts

Posted 14 November 2006 - 01:28 AM

My friend and I are trying to find a way to load an .as file in a similar way to loading xml. The idea is to store an actionscript inside an xml file but it doesn't seem to work. I tried making an .as file and importing it to flash document the way it imports it is that it just places all the script in the actions panel. This is a flowchart of what we want to do:

[make an external file which contains ACTIONSCRIPTS]
|
[make a script that loads external file w/o pasting code into panel]
|
[call a function from external file]

#2 Guest_FeedBacker_*

Guest_FeedBacker_*
  • Guests

Posted 12 November 2007 - 12:51 PM

First of all, flash cant load external scripts dynamically, but can load at compile time. Just write the code AS in an external file (viz myScript.as) and load it by the code #include "myScript.as" (Flash simply replaces that line wwith the code frm file). Alternatively you can make an external swf which contains all ur functions in it, and call them at runtime, thus making a little dynamicity :).

-Samah

#3 Guest_FeedBacker_*

Guest_FeedBacker_*
  • Guests

Posted 16 April 2008 - 10:39 PM

include external .as file
Loading External Actionscript

Just do this:



#include "externalfile.As"





Note: **NO** semicolon at the end. This is for ActionScript 2.



-reply by pogo

#4 bcarasco

bcarasco

    Newbie [ Level 1 ]

  • Members
  • 7 posts
  • Gender:Male
  • Location:Portland, OR

Posted 03 July 2008 - 06:19 PM

But if you are using Actionscript 3 this is the way to do it
include "scripts/myscript.as"

There were many changes between Actionscript 2 to Actionscript three. One of them was getting rid of the "#" before the include directive. Including files is very useful say if you wanted to create a class in AS. It's much easier to interpert your code if you include it in a seperate AS file.

#5 magiccode9

magiccode9

    Advanced Member

  • [HOSTED]
  • 162 posts
  • Gender:Male
  • myCENTs:77.89

Posted 02 September 2008 - 02:06 PM

But as a little reminder.
Actionscript 2.0's #include command can't include code file with class
If you do that it will generate an error on output panel.

For code file with class in it.
Just open the flash publish setting and configure the correct classpath.
And the class file will load automatically.

P.S This is only for flash 8 only. I haven't the newer version for testing. :mellow:

Edited by magiccode9, 02 September 2008 - 02:09 PM.


#6 Guest_(G)Ian_*

Guest_(G)Ian_*
  • Guests

Posted 07 January 2010 - 08:36 AM

Is it possible to include a dynamic file as an as file?Loading External ActionscriptWould this work?Include "scripts/myscript.Php"All my php would contain valid actionscript

#7 Guest_(G)timtom_*

Guest_(G)timtom_*
  • Guests

Posted 03 February 2010 - 06:30 PM

no, PHP wouldn't work because as stated, it's used during COMPILE TIME, so as soon as you have the SWF deployed, and change the PHP (AS) file it's going to break.

You're going to want to look into data transfer options such as loading external XML, TXT or FlashVars. THose are made for things that require updating. 

-reply by timtom

#8 Guest_(G)mememe_*

Guest_(G)mememe_*
  • Guests

Posted 09 February 2010 - 05:32 PM

I think that is not useful.  The php file can be dynamic but I think the swf only

pulls in a include file during compile, which means you get the first php result in your compile 

and it never changes until you re-compile.

Using an "eval" statement on action script that is pulled from the CDATA in an xml file 

would be a solution.  See this URL

http://danielmclaren.Net/2008/09/21/eval-in-as3-tips-for-executing-dynamic-actionscript

 

I will just add that allowing users to input action script that is executed is not something I 

would ever recommend under any circumstances.

 

 

-reply by mememe

#9 Guest_(G)Zimbirti Baba_*

Guest_(G)Zimbirti Baba_*
  • Guests

Posted 19 February 2010 - 08:20 AM

Thank you very nice comment.

I am understand it but doesnt worked. Using in atasözleri web site.

Can anyone help me? 

-reply by Zimbirti Baba

#10 Guest_(G)Codzprc_*

Guest_(G)Codzprc_*
  • Guests

Posted 23 February 2010 - 11:55 PM

movie load, script loads... movie doesnLoading External Actionscript

I've got a swf (control.Swf) that loads an xml based slideshow swf (slideshow.Swf). I've tried simply loading slideshow.Swf into control.Swf, and it loads fine, however, the actionscript that makes the slideshow work doesn't appear to be coming along. So, I exported it and included it in control.Swf -- but it's still not playing correctly, and I am receiving no errors.

 

Separately, the slideshow works properly - loading in images, text, and links from an external xml

 

Control.Swf code:

loadMovie("slideshow.Swf", _root.Tier5_mc); 

#include "loadInfo.As"

 

Do I need to tell control.Swf where to include the code? It should be global correct? I'm obviously doing something wrong, I've seen sites that use loadMovie to load in navigation (presumably xml based), slideshows, ect into one swf, so pieces can be worked on separately... I just can't figure out what I'm doing wrong -- most likely missing a few lines of code -- or maybe using an incorrect method. 

Any and all help appreciated! 

-question by Codzprc


#11 Guest_(G)mihnescu_*

Guest_(G)mihnescu_*
  • Guests

Posted 09 May 2010 - 08:29 PM

Load dynamic as code at runtimeLoading External Actionscript

If anyone still need this. You can compile all your classes in anExternal SWF @runtime and load that external SWF dynamicaly from yourMain SWF. After you can instantiate objects that are compiled in theLoaded SWF (see the Class type in AS3 and getDefinitionByName("MyClass") where "MyClass" is can be a class defined in the exported swf.

You can have a PHP file that runs a serverside script that compiles an .AsFile into a SWF when it's called by your main SWF app.

 I knowIt's a handful but it's possible. Hope it helps :).

 

-mihnea

-reply by mihnescu



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users