Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Actionscript Problem With Loaded Swf



I have created a small game with many library items and it uses actionscript classes heavily to control movement of particles. Because all of these things need to be loaded on the first frame of the .swf so they can be referenced from the scripts at any time I must use a secondary .swf to load the game into to create my preloader. However I have found that when I do this it seems as if my game can no longer reference the Actionscript classes. I have been working on a fix for this for several days but I am now basically back at square one. Any help would be greatly appreciated as to why this is doing this. If my question isn't clear please let me know.



ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 07-30-2007, 06:55 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Giving Actionscript To An Actionscript-loaded Movie
How can I (if possible) set actionscript (say, an on-mouse event) to a movie that I load via attachMovie()? I poked around and I couldn't seem to find an answer...

I want the movie that I load via attachMovie() to have an on(RollOver) event...any thoughts?

Warning: An ActionScript 1.0/2.0 SWF File Has Loaded An ActionScript 3.0 SWF;
Hi all,

I'm trying to clone an swf (produced in CS3) that has been loaded into my app (built using Actionscript/mxmlc) but keep getting the following message appear in my logs:


Code:
Warning: An ActionScript 1.0/2.0 SWF file has loaded an ActionScript 3.0 SWF; code in the ActionScript 3.0 SWF will not run.
I know the CS3 swf has been produced using Actionscript 3 as it's settings and published for FP9. It does nothing more than a motion tween of a graphic.

Here is a really simple example of how to emulate the problem:

ActionScript Code:
package{

    import flash.display.Loader;
    import flash.display.MovieClip;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.net.URLRequest;
   
    [SWF(backgroundColor=0x000000)]

    public class Test extends Sprite{
       
        private var _mc:MovieClip;
   
        public function Test():void{
       
            var mc:String = "rain.swf";
            var ldr:Loader = new Loader();
           
            ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,loadedSWF);
            ldr.load(new URLRequest(mc));
        }
       
        private function loadedSWF(e:Event):void{
           
            var mc:MovieClip = MovieClip(e.target.content);
           
            this._mc = MovieClip(new (mc.constructor)());
            this.addChild(this._mc);
        }
   
    }
}

I'm using the following version of mxmlc: Version 3.0.0 build 1844

I've also tried a slightly more convoluted way:

ActionScript Code:
package{

    import flash.display.Loader;
    import flash.display.MovieClip;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.utils.getQualifiedClassName;
    import flash.net.URLRequest;
   
    [SWF(backgroundColor=0x000000)]

    public class Test extends Sprite{
       
        private var _mc:MovieClip;
   
        public function Test():void{
       
            var mc:String = "rain.swf";
            var ldr:Loader = new Loader();
           
            ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,loadedSWF);
            ldr.load(new URLRequest(mc));
        }
       
        private function loadedSWF(e:Event):void{
           
            var c:Class = Class(e.target.applicationDomain.getDefinition(getQualifiedClassName(e.target.content)));
            this._mc = new c();
           
            this.addChild(this._mc);
        }
   
    }
}

I would like to know what's causing the warning message, am I doing something wrong?

Actionscript Loaded Dynamically?
Is there a way to have an actionscript written in a .txt document and loaded dynamically into a flash movie?

thanx!

Actionscript: End Frame Loaded?
ok, my problem is this: i work with flash 5 and i've been trying and trying to make my first very basic preloader with the help of a tutorial from here, the problem is that according to the tutorial i need to use the: 'End Frame Loaded' command at the end of the actionscript in my first frame, and i can't seem to find it or find a way to type it in manually....am i trying to use an obsolete flash 5 command? or am i just doing something wrong again?
please help!
p.s. (it was the eddie carrol tutorial on basic preloaders and basic bar preloaders, wich if you don't have my problem is a great tutorial!)

Actionscript: End Frame Loaded?
i'm having a lot of problems because of this command and other "end related" commands, i use flash 5 and i've ben trying to create a basic preloader with the help of a tutorial from here (eddie carroll) but he uses the 'end Frame Loaded' command several times and i can't find it anywhere. also i've been trying to create a sound on and off toggle but again in the tutorial i've been using there are actionscript statements using the term 'end' that i can't find anywhere....
am i doing something completely wrong or what?
somebody help me!

How To Get Height Of A Loaded Jpg, Using Actionscript
hi everybody ! !

here is my pb of the day


i need to know how to get height of a loaded jpg,
using actionscript of course ...


thx.

Actionscript In Loaded Movies
Hi,

Maybe this has been asked for a thousand times, but it's simple answered...:

Do i use loadMovie(...) or loadMovieNum(...) to keep the actionscript activity alive in the loaded swf-file?
I'd like to use loadMovie for better control of the loaded movie, is that possible somehow?

Thanks alot!

Cheers,
va

Width Of Loaded Jpg With Actionscript
I'm trying to get the width of a movieClip after I load the jpg into a movie clip but I always get a return of 0. How is this done?

[CS3] Keeping The Actionscript In A Loaded SWF
When I try to load a SWF in a movie clip in another file, some of the action script in the external file won't work when loaded. How can I load it so that it still works like it's supposed to? I'm loading it using this code within the movie clip:


Code:
loadMovie("Puzzle.swf", this);
If I load it to the main time line everything works fine. But then I can't get back where i was on the timelime line with a fade.

No ActionScript In Loaded Swf For Other Server
The actionscript within a loadMovieClip swf doesn't execute code. The twist is that it does work if both the main file and linked swf are on the same server. It does not if they are on different servers.

What's up?

Actionscript In Loaded Movie...?
Dear Flash User,

I come up with a silly problem. I am not sure what I missed but... I loaded an external movie into my Flash document. I am successful in loading and playing it but the interactivity of the buttons within the loaded movie is lost. It doesn't do what it was suppose to do. I would like to know if we can make the interactivity of the loaded movie work. Please help me in this.

Rabi

Dynamically Loaded Actionscript
What does this mean??


Quote:




Originally posted byMannequin:Load sensitive actionscript dynamically, either through remoting techniques or by using loadVars.





(in this thread:
http://www.kirupaforum.com/forums/sh...5&pagenumber=3 )

I know you cant include .as files at runtime. Does he mean loading external swfs that are all code, or is there something about loadvars that I dont know...

Actionscript In Loaded Movie...?
Dear Flash User,

I come up with a silly problem. I am not sure what I missed but... I loaded an external movie into my Flash document. I am successful in loading and playing it but the interactivity of the buttons within the loaded movie is lost. It doesn't do what it was suppose to do. I would like to know if we can make the interactivity of the loaded movie work. Please help me in this.

Rabi

Dynamically Loaded Actionscript
What does this mean??


Quote:




Originally posted byMannequin:Load sensitive actionscript dynamically, either through remoting techniques or by using loadVars.





(in this thread:
http://www.kirupaforum.com/forums/sh...5&pagenumber=3 )

I know you cant include .as files at runtime. Does he mean loading external swfs that are all code, or is there something about loadvars that I dont know...

Actionscript Fails When Loaded To A Target
I have a feedback form in a swf loaded to a target in my main movie. It contains a 2 frame MC that acts as a checkbox. The actionscript that controls this 'checkbox MC' is:-

on (release) {
Options = Options add "Interactive solutions" add ", ";
tellTarget ("/MCOption6") {
gotoAndStop (2);
}
}

Can I Put ActionScript In A Txt-file That Is Dynamically Loaded Into An Swf?
I have a textBox inside a swf that loads an external txt-file with html code...

In the html code that I use in the txt-file I have used the <a href=""> tag, now what I want to know is if I can use ActionScript here, like for instance '_level2.gotoAndPlay(4);'

I can't seem to get it to work... What's the proper syntax if this is possible at all?

???

Cheerz...
/A.

Actionscript Of Loaded Movie Does Not Works
I am loading a movie in a movie clip,, now the movie which is being loaded is a scroller , but as it is loaded in a movie clip , the actionscript of the scroller stops working,
just see this:-
scroller.swf
Now i load this scroller in a movie clip of other fla
loadMovie ("Ticker.swf", "_root.mymc";
and now when i publish it, an error is given
Target not found: Target="/scrollleft" Base="_level0.mymc"

Actionscript: Movement Inside Loaded MC
Hey everyone…
I created a “slider” as part of a header for a site I’m building which worked fine until I sectioned off the header, and decided to load that as a separate MC into my main movie. Now the slider doesn’t function, but I’m not exactly sure how to fix it.

The setup: (I’m winging it on the code, because I’m at another computer)

1. A controller MC that does the majority of the work: (Moving from right to left)
Its script:

OnClipEvent (enterFrame) {
If (textMove ==”yes” && Slider._x > 500) {
Slider._x -= 10;
If (textMove ==”no” && Slider._x < 800)
Slider._x +=10;
}

2. The button that triggers rollover
Basically like this, pretty standard:

On (rollover) {
TextMove = “yes”;
}
On (rollout) {
TextMove =”no”;
}

This interacts with the above “Controller MC”
So the point is that basically the whole thing worked when it was set up within my main movie, but now that I’ve made it a separate MC loaded into my man movie, it doesn’t work. My gut tells me that it should be a relatively simple adjustment but I’m not sure where to start. The X and Y coordinates? If so, what do I change them to? What else could the problem be?

Thank you all.

Actionscript Stops Working When Ext. Swf Is Loaded
I have one of those Blarney's type scrollers (buttons move the images to a location and they slow down as they approach their destination). All of it works in the separate swfs, but once I load them into the 'home' swf all the actionscript stops working. So all of the buttons appear, but nothing happens when I click on them.
I've checked the paths, added the path from the true root (the home page), to the blank MC that holds the external files, but it still will not work.
Am I missing something obvious? Everything works perfectly as separate files.
Any suggestions would be appreciated.
Thanks.

Executing Sound Via Actionscript When Loaded Into Another Swf
i have like 6 swf's and they are loaded into the main one.
one of them has hit = new Sound();
hit.attachSound("hit2");
hit.start(0,1);

and this works, but when it loads into the main.swf -- no sound plays

Positioning A Loaded Movie Using Actionscript
Hi! Need a little help on actionscripting...I actually tried to use the flashtyper, but it doesn't seem to work, so i'm trying to do things the long way by downloading the source and loading it as an swf file into the movie that i will be using it in. I was able to load the SWF file into level 1 of my main movie, but not in a target movieclip. It doesn't seem to work right when i load it into a movie clip.

Anyway, i used the load movie script in the first frame to load the movie, and in the second frame, i added a set property script to set the x and y positions of the movie that i loaded. Problem is, the movie loads on the first frame, and plays automatically without following the positions i indicated in the second frame. I tried to move the set propoerty scripts in the first frame, but that doesn't seem to work too. It only follows the set property positions after it played the loaded swf file once.

Is there a way to prevent the loaded movie from playing right away, so that it follows the x and y positions that are indicated on frame 2? I'm just beginning with actionscript and not quite sure if the script i'm doing is right. Maybe i'm lacking a script or something. Any help you can give will be greatly appreciated!Ü Thanks!

By the way, I'm using flash MX

Actionscript Not Working In Loaded Movies
Does anyone know why when I load a swf into an empty movie clip the actionscript/interaction doesn't work?
Thanks

Resizing In Loaded In Movie Using Actionscript
Hi Chaps

Is it possible to resize the dimensions of a loaded in movie using actionscript?

If so how?

For a bit of an explanation of what i'm doing.
Creating a presentation with a movie(mpeg 4 saved as swf) in it. When a button is pressed, that movie needs to be enlarged

Loaded External Txt Has Link To Actionscript
Is it possible to have a line of externally loaded
text link to a line of actionscript that can trigger something to happen within a flash movie.
-
similiar to a hyperlink but it doesn't open a browser window, instead it communicates with the flash movie itself ????
Thanks

ActionScript For Loading An Swf Dependant On One Already Loaded
I created a empty container Movie clip that will load a certain .swf file depending on what button is clicked on the main stage.

How can I tell the button to play a certain .swf DEPENDING on what is already loaded in the container from a previous choice the user made?

my ActionScript pseudocode for the button would probably look something like:
if x.swf is loaded
then play y.swf
...
Any suggestion would rock my face off! Thank you all

Actionscript To Hold On Loadmovie Until Loaded
Hey, I am new to actionscripting and I have a sequence of loadmovies (each has a preloader) which I would like to load one after another in sequence, instead of all at the same time. I am sure that it is very simple, but it is eluding me. Any ideas? Thanks.

This is what I currently have.

loadMovie("people2.swf", holder2);
loadMovie("people3.swf", holder3);
loadMovie("people4.swf", holder4);
loadMovie("people5.swf", holder5);
loadMovie("people6.swf", holder6);
loadMovie("people7.swf", holder7);
loadMovie("people8.swf", holder8);
loadMovie("people9.swf", holder9);
gotoAndStop("i1");

Actionscript For Holding On Loadmovie Until Loaded
Hey, I am new to actionscripting and I have a sequence of loadmovies (each has a preloader) which I would like to load one after another in sequence, instead of all at the same time. I am sure that it is very simple, but it is eluding me. Any ideas? Thanks.

This is what I currently have.

loadMovie("people2.swf", holder2);
loadMovie("people3.swf", holder3);
loadMovie("people4.swf", holder4);
loadMovie("people5.swf", holder5);
loadMovie("people6.swf", holder6);
loadMovie("people7.swf", holder7);
loadMovie("people8.swf", holder8);
loadMovie("people9.swf", holder9);
gotoAndStop("i1");

(reposted from general questions)

What Actionscript Do I Put At The End Of The Externally Loaded Movie?
Hi there!

on frame one of the main timeline I am loading an external movie.

When that movie gets finishes playing, I want to jump back to the main timeline, to frame 2.

What actionscript do I put at the end of the externally loaded movie?

stop();

this.parent gotoAndPlay(2); ?????

Actionscript In Externally Loaded SWF Assets
Can anyone explain the model for actionscript in externally loaded SWF assets? For example, suppose the stage owner uses methods from Class1 and that it loads an SWF file with an asset that also uses methods from that class. This means the code for Class1 is included multiple times in the application?

What is the best practice for such a situation?

F5 Actionscript: Preloading Dinamically Loaded Swf
I've built a flash 5 application that works into director 8.5 project. It's a simple browser that displays a number of images (.swf files) in a sort of Windows' preview style. The user can scroll up and down the array of images. Since there's more than one set of images, I've made it all dinamyc by loading the data (swf name, swf label,...) from an external XML file. Director sends a var to Flash and depending on the value of that variable, the flash movie loades the corresponding xml file and images set. Now, since I came up to a 200 for (10-12 kb each) images set, running the thing from a CD might be really slow. What I do need is a sort of preloader that makes the user quietly wait until all the resources have been loaded into memory.


Has anyone got some helpful suggestions?

Loaded Movie Actionscript Question...
Hello. I am fairly new to Actionscript, and I have a problem that I hope all you clever Flash users can help me with.

Basically, I downloaded and figured out how to use The Stickman's tutorial on the Barney's sliding menu, but my problem is that when I load this into a movieclip holder in a different main movie, it does not work.

I'm not quite sure why? Can anybody give me any help?

The Stickman's Tutorial is here:
http://www.the-stickman.com/tutorial...eys_menu.shtml

Irene

Controlling An Externally Loaded .swf's Actionscript
Here is my problem, I am loading a .swf that a previous developer made (don't have the .fla) but the actionscript at the end of the movie is resolving to home.html. Instead of it resolving to home.html I would like for it to instead have gotoandPlay. Is this possible to do?

Thanks for any tips or advice.

ActionScript 3.0: How To Communicate With Loaded Movies?
Hi,
I have a site I am building in AS3. I have a main SWF, site.swf, that loads the subsections as seperate SWF's only when a user clicks on them (to save on initial load time).

For my subsections, I need to be able to communicate with the SWF that loaded it. In AS2, this was simple enough - just say something like _parent._parent.gotoAndPlay("something"), and step up enough levels to speak to movie clips in the main SWF.

Trying to do this in AS3, however, results in errors such as this when trying to compile my subsection SWF:


Code:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
... because it thinks I am trying to communicate with something that doesn't exist. The result is that I can't compile my subsection SWF's.

For example, I am unable to reference a variable in the main SWF using this code in my subsection SWF:


Code:
myText = this.parent.parent.parent.parent.sectionTitle;
Surely there must be a way to do this? Can I at least tell the Flash 9 Alpha compiler not to stop when it runs across this?

Thanks,
Graham

Preloading W/o Loaded Swf Playing First Frame's Actionscript
Just what the subject says. I need to update an existing flash app that needs to be backwards compatible with our previous content. The new app includes preloading, but a problem we're having is that the first frame of the preloaded swf (loading just into a hidden mc) automatically plays and therefore, even tho stopped, will execute any script on that frame.

Can anyone think of a workaround? Like being able to negate any command or variable sent to any possible location until a later time?

Adding Scrollbar Via Actionscript After Text Is Loaded
Okay, I know this has probably been beaten to death, and I used to know it. But for the life of be, I can't remember how.

1. I am adding text from a .txt file straight into a dynamic text box. I would like to add a scrollbar component on via actionscript (so I can do it after the text loads).

2. Also, I would like to do it only when neccesary. How could I do the first part, and if so, the second part?

Mx-04-actionscript In Movie Won't Behave When Loaded Into Empty Mc
I'm trying to load an outside movie (through loadMovie) into an empty movie clip into another movie using a simple button to activate the process. However, after it loads, the outside movie doesn't play how it normally does. The outside movie uses mx.transitions all located on only the first frame. The timing and when each new transition occurs becomes completely off from the original when loaded.

note: This is for a portfolio site (based in flash) and i'm just trying to showcase a banner ad design (the loaded movie). It's not a large file at all.

any input is welcomed!

Suspending Actionscript From Running On Externally Loaded SWF
I have a new challenge for which I've used Flash version CS3. I haven't touched on AS3 as of yet though (chose to use AS2 with which I am more familiar) but I thought I'd post here incase I should be using AS3 to solve the problem.

I'm creating a "bootstrap" for want of a better description - a flash movie that uses a MovieClipLoader to load an external SWF file into a container clip. This I have working. I then gotoAndStop the loaded movie at frame 1 and present a button to allow the user to play that movie when they're ready. Again, all fine, most of the time. The issue is that some of the movies I'm loading and then pausing have actionscript of their own and they're playing themselves and generally getting into a mess.

So the question ultimately is, is there a statement or command I can use to suspend the actionscript of externally loaded SWFs?

ActionScript In TextField Loaded With Html Code
Is there any way to load HTML text (with hyperlinks) into TextField as if I click on the link it will not opens link in browser, but executes some ActionScript?

ActionScript In TextField Loaded With Html Code
Is there any way to load HTML text (with hyperlinks) into TextField as if I click on the link it will not opens link in browser, but executes some ActionScript?

Dynamically Loaded Text File + Actionscript?
Hey guys is there any way to place actionscript in a dynamically loaded text file? I've been playing round for a while and i cant seem to get it. I saw this on actionscripts.org http://www.actionscript.org/tutorials/intermediate/Invoking_Actions_From_HTML_Textfields/index.shtml

so i t might be possible?

Anyone with any ideas thanks heaps.

Get Size Of Actionscript Loaded Movie Clip
I've got a movie clip named x, with size 0,0. I create a new movie clip inside x (in actionscripting) and load a image to it, when I try to get x width it says its 0 if i try to get the new movie clip width it alsow says that it's 0.


Anyone can help???

Actionscript Stop And Start Swf Loaded Files
can anyone please help. i can load a swf file using loadmovienum. and i have the file on level 3. the name of the file is beg.swf i can also unload it using a stop button using unloadmovie. however i want to create 2 more buttons that allow me to pause, and rewind. can anyone send me a actionscript based on what i have put here. like i said i load my movie in on a level.
cant seem to work out this problem.
thanks

Links In Loaded HTML To Call Actionscript?
HI THERE!

So I have fairly simple site construction that loads swf files for each section, and the content for each section is just an external html file.

My question though, how can an achor tag in the HTML call the actionscript to switch the swf? Basically, you click a link in the html to go to a different section (load new swf) of the site...

since the supported HTML elements are limited when working with flash, how would I go about coding this?


THANKs
-SD

Actionscript To Not Play Flash Untili All Html Is Loaded?
hi,

i was wondering if there is an actionscript that will tell the flash movie NOT to continue past a certain point (a point i would specify) until the entire html document it is on is finished loading? also, is there one for a flash movie in frames?

'export As Actionscript' Problems; Or Naming A Loaded MC Using LoadMovieNum();
hey all-

ive got a two related problems, and if you can solve either one, ill be a happy man:

Problem #1:
ive got a slideshow of images that i made in flash. each image is contained in its own MC and im using the 'export as actionscript' command. the slideshow works fine when i preview the swf. however, this slideshow swf ultimately needs to be loaded into another movie. At first I used the loadMovie() command to load the swf into a blank MC that i had on my stage. However, when I used this method, the slideshow didn't work and none of the images appeared. i assumed this had something to do with levels and/or path names.

Problem #2:
at the suggestion of another flashkit member, I used the loadMovieNum() command to load the slideshow swf into a new level, as opposed to using the loadMovie() command to load it into a blank MC. This solved the original problem of making the slideshow functional, however, it created a new problem:
is there a way to 'name' an MC that you load using loadMovieNum? loading a movie into a level (for instance, level 2) as opposed to loading a movie into a blank MC doesnt give me the ability to access/alter any of the MC's properties. for instance, if i loaded my movie with the call,

blankMC.loadMovie("slideshow.swf");

then later on, i could redefine newMC's properties by saying things such as,

blankMC._alpha=0;
blankMC._x=250;
(etc etc etc)

but if im loading the movie using loadMovieNum(), as in

loadMovieNum("slideshow", 2);

then is there any way to name this new MC, or any way at all that i can target its properties? ugh...!

Sorry about the long post. Any ideas greatly appreciated!
Cheers
j

Using Actionscript To Position A Dynamically Loaded Swf File Behind An Exsisting Mc O
Hi all,

I'm trying to get a dynamically loaded swf to load into an empty mc behind a particular mc on the stage. I used actionscript to create an empty movie clip using the createEmptyMovieClip command. But, how can i get it to create it, then load the external .swf into it behind a exsisting mc on the stage? Is this possible?

thank you,

Aaron

Using Actionscript To Position A Dynamically Loaded Swf File Behind An Exsisting Mc
Hi all,

I'm trying to get a dynamically loaded swf to load into an empty mc behind a particular mc on the stage. I used actionscript to create an empty movie clip using the createEmptyMovieClip command. But, how can i get it to create it, then load the external .swf into it behind a exsisting mc on the stage? Is this possible?

thank you,

Aaron

Using Actionscript To Position A Dynamically Loaded Swf File Behind An Exsisting Mc O
Hi all,

I'm trying to get a dynamically loaded swf to load into an empty mc behind a particular mc on the stage. I used actionscript to create an empty movie clip using the createEmptyMovieClip command. But, how can i get it to create it, then load the external .swf into it behind a exsisting mc on the stage? Is this possible?

thank you,

Aaron

Copyright © 2005-08 www.BigResource.com, All rights reserved