|
|
|
| Web Hosting Guide |
![]() ![]() |
Loading External Actionscript |
Nov 14 2006, 01:28 AM
Post
#1
|
|
|
Premium Member Group: Members Posts: 330 Joined: 2-February 06 Member No.: 11,040 |
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] |
|
|
|
Nov 12 2007, 12:51 PM
Post
#2
|
|
|
Newbie [ Level 1 ] Group: Members Posts: 0 Joined: 1-November 07 Member No.: 25,869 |
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 |
|
|
|
Apr 16 2008, 10:39 PM
Post
#3
|
|
|
Newbie [ Level 1 ] Group: Members Posts: 0 Joined: 1-November 07 Member No.: 25,869 |
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 |
|
|
|
Jul 3 2008, 06:19 PM
Post
#4
|
|
|
Newbie [ Level 1 ] Group: Members Posts: 7 Joined: 3-July 08 From: Portland, OR Member No.: 31,268 |
But if you are using Actionscript 3 this is the way to do it
CODE 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. |
|
|
|
Sep 2 2008, 02:06 PM
Post
#5
|
|
|
Advanced Member Group: [HOSTED] Posts: 145 Joined: 7-November 05 Member No.: 9,489 myCENTs:33.08 |
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. This post has been edited by magiccode9: Sep 2 2008, 02:09 PM |
|
|
|
![]() ![]() |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Similar Topics
| Topic Title | Replies | Topic Starter | Views | Last Action | |||
|---|---|---|---|---|---|---|---|
![]() |
2 | Jimmy89 | 2,199 | 4th November 2009 - 10:25 PM Last post by: HannahI |
|||
![]() |
8 | dserban | 3,583 | 20th October 2009 - 11:24 PM Last post by: iG-Biff |
|||
![]() |
3 | takerraj | 57 | 11th October 2009 - 06:09 PM Last post by: yordan |
|||
![]() |
6 | Default Tutorial | 755 | 13th August 2009 - 01:20 AM Last post by: akashi |
|||
![]() |
5 | ganeshn11 | 2,305 | 10th July 2009 - 05:50 AM Last post by: iGuest |
|||
![]() |
14 | Jimmy89 | 4,697 | 27th April 2009 - 01:47 AM Last post by: Atomic0 |
|||
![]() |
6 | arunkumarhg | 2,258 | 1st December 2008 - 07:01 PM Last post by: magiccode9 |
|||
![]() |
11 | toby | 700 | 13th November 2008 - 12:31 PM Last post by: toby |
|||
![]() |
1 | khalilov | 422 | 31st August 2008 - 10:53 PM Last post by: faulty.lee |
|||
![]() |
7 | Chesso | 3,170 | 13th June 2008 - 06:48 AM Last post by: iGuest |
|||
![]() |
6 | ChristopherJ05 | 2,001 | 24th May 2008 - 04:06 AM Last post by: iGuest |
|||
![]() |
2 | evought | 2,197 | 21st March 2008 - 09:03 PM Last post by: toby |
|||
![]() |
2 | sparkx | 1,172 | 29th February 2008 - 09:25 AM Last post by: iGuest |
|||
![]() |
7 | Habble | 4,291 | 25th February 2008 - 12:36 AM Last post by: java-area |
|||
![]() |
2 | TavoxPeru | 1,206 | 17th February 2008 - 05:17 AM Last post by: TavoxPeru |
|||
|
Lo-Fi Version | Time is now: 8th November 2009 - 07:41 PM |
© 2009 AstaHost: Free Web Hosting & Technical Discussion, Free Web Hosting. a member of xisto.
Powered by Invision Board. Skin: IPB Forum Skins
Expand / Collapse Navigation



Nov 14 2006, 01:28 AM




