Professional :: Loaded SWF Runs Code On Parent Timeline?

Nov 30, 2010

I have a parent movie that contains several buttons that load several child SWF files.The parent timeline has only 1 frame, and in that frame all the ActionScript (version 3) for the parent movie is imported with a single statement:
 
include "script.as"; 

The problem is that when a child movie loads, IF the child contains ANY ActionScript calls, it also somehow runs the code in "script.as", which accesses many elements of the parent movie which are not present in the child. This produces "NULL object reference" errors which crash the script:
 
TypeError: Error #1009: Cannot access a property or method of a null object reference.If I remove all ActionScript calls from the child's timeline, then the child doesn't run the parent's code - But if place so much as a stop(); call in the child timeline, then the child runs the parent's code after being loaded in.
 
I originally wrote this script for another project, which works fine, and then copied and pasted it to this one, so I don't understand why it's not working the same way. Earlier on I suspected the trouble might be from re-saving my current project as ActionScript 3, when before this upgrade was saved as ActionScript 2. So I went back and re-created each file in fresh AS3 FLAs, but it didn't solve the problem.The child SWFs are loaded with this code from "script.as".

var ldr:Loader = new Loader();    addChild(ldr);    var url:String = "child.swf";    var urlReq:URLRequest = new URLRequest(url);    ldr.load(urlReq); 

Also in "script.as" is a simple trace call at the top of the file:
 
trace('script.as is running'); 

When de-bugging the file, the message 'script.as is running' appears in the output panel when each child SWF is loaded, which tells me that the child files are running the parent's code. Is there any way to prevent this from happening?

View 6 Replies


Similar Posts:


ActionScript 3.0 :: Write Code That Runs Throughout Timeline?

Feb 17, 2011

I have a button named 'red_btn' which is placed on different keyframes at different positions on the stage. but the function of all the instances is same, on mouse over should move timeline to nextframe. [code]...

View 1 Replies

Professional :: Make Code Which Runs Every Time The Mouse Is Clicked Anywhere

Jan 6, 2011

How do I make code which runs every time the mouse is clicked anywhere (not on any specific object) using AS1

View 1 Replies

ActionScript 3.0 :: Get A Loaded SWF To Control Parent Timeline?

Aug 25, 2009

I have a swf that loads an external swf. I want the external swf, (the one that was just loaded), to interact with the timeline of the swf that just loaded it. I've been trying MovieClip(root). or MovieClip(parent). but they give me errors. How should I use as3 in the external swf so that it interacts correctly with the parent?

View 3 Replies

ActionScript 3.0 :: Timeline Actions Ignored When Loaded Into Parent Swf

Jan 25, 2009

If I have a movieclip in my library with some animation on the timeline and actions as well (stops, calls to other methods, etc.) and at runtime I add this clip to the display list, everything works as expected. The actions in the timeline of said clip are fired.If however, I load this file into another swf all the actions in the movieclip are ignored.Attached is a demonstration of this behavior. simply runnning Child.swf on it's own will show nothing as there is a stop on the first frame of the attached clip. However run the Shell.swf (which loads Child.swf) and you'll see the animation of the movie clip. There are no calls anywhere telling anything to start playing. What's worse, the method call further down the timeline and the stop and the end of the timeline are also ignored. Compiling these files and looking at the Output window, you'll see the trace from the method "__testCall" is never fired.Is this a bug with the Flash Player?I've had to use addFrameScript as an alternative to actually having the actions on the timeline. lame.

View 3 Replies

ActionScript 3.0 :: Control Of Externally Loaded Child Movieclip Timeline From Parent?

Mar 3, 2009

I have a basic xml driven portfolio. The xml file holds the path to the portfolio pieces (external .swfs). I have a main navigation that moves from project to project and a subnavigation to view individual pages of that project.The subnav is where I have the problem, I simply want to call gotoAndPlay("framelabel") of the designated mc. It seems that you can no longer call to the timeline of child movieclips as you could with AS 2. I've found some examples Except the examples discuss access of nested movieclips on the stage with assigned instance names. But the problem I'm facing is that I have each item pulled in via the loader Class then the objects are pushed into an array and my subnav needs to access them dynamically via array notation.something like this:

PHP Code:
public function loadMe(){
//var l:Loader = new Loader();

[code].....

View 12 Replies

ActionScript 3.0 :: Timeline Code Not Running In Loaded Swf

Oct 26, 2010

I am publishing an animation which needs to dispatch events from certain frames on the timeline. The document class is InteractiveAnimation - here's the important bit:[code]When I load it into my player application (into the same ApplicationDomain, I might add) all I get is:"Running constructor of InteractiveAnimation" the timeline trace doesn't happen. Or any other timeline code for that matter.What is killing the framescripts? Has anyone even got any suggestions as to how I might continue to track this down?

View 2 Replies

ActionScript 3.0 :: Loaded Clip's Timeline Code Ignored?

Jul 19, 2010

I've loaded a clip (with a stop() and a trace() on the first frame) in my main swf but somehow when it's loaded and added on the stage it neither stops nor do the trace command, here's my code:

PHP Code:

package {
import flash.display.*;
import flash.events.*;
import flash.net.*;

[code]....

inside the Oval class which is linked to Oval.fla, there's nothing but another trace(). This trace works though.

View 3 Replies

Professional :: Access Methods From/to Parent And Loaded Child Swfs?

Sep 14, 2010

Imagine the following setup. The main swf loads a child swf.In AS2 i would simply use _parent or _root to call the desired function. How can that be done in AS3?Can this still be done? Can I call a function on the main swf from the loaded one? How about the other way around, this time, from main to loaded swf?

View 1 Replies

IDE :: Timeline Based Animation Runs Choppy In Some Browsers?

Jan 13, 2009

Try to wrap my head around why sometimes a timeline base animation will run choppy in some browsers. Is it processor speed vs frame rate. I boosted my framerate to 29.97 but on older computers the animation is very arthritic.

View 1 Replies

ActionScript 3.0 :: Change Parent Timeline From A Button In The 'Child' Timeline

Apr 30, 2009

I am just trying to use actionscript 3.0 (Flash CS4) to change the 'Parent' timeline from a button in the 'Child' timeline

[Code]...

View 2 Replies

ActionScript 3.0 :: Flex Mxmlc Access Of Undefined Property Even Though The Code Runs Fine In Flash IDE

Dec 28, 2009

I've been trying for hours to make sense of this problem. When I run my code through the Flash IDE, everthing is fine. However, when I run it through the command line compiler or Flex itself t doesn't work. This is after setting up all the required Flex bits to create a Flash stage and display content. it keeps giving me an "Access of undefined property" error though I've clearly defined those properties in question a line or two before.

[Code]...

What the heck is going on?? I'm stumped. Embed seems to work fine, but I'd prefer to change it this way. I think there's something about XML dynamism if you use embed instead.

View 6 Replies

IDE :: Child Movieclip Timeline Changes Don't Show In Parent Timeline?

May 21, 2009

Why does a child movieclip only show the first frame within the IDE, regardless of where you are in the parent timeline?If you throw a movieclip with 25 frames onto the main timeline, which also has 25 frame, you don't see the nested movieclip's frame-progress while you scroll through the main timeline.Is there a setting somewhere in preferences or somewhere that will enable you to see a nested movieclip's frame position from the main timeline?  Like you do with After Effects composites?

View 3 Replies

ActionScript 1/2 :: External Swf's When Loaded Runs Very Slow Or Unresponsive?

Mar 27, 2011

You can download it here [URL]external swf's when loaded.....run very very slow; sometimes unresponsive as if there is a script running in the background. I'm using keyboard commands to navigate through the screens - eg:on (keyPress "<Space>") {gotoAndStop("scene02", "firstframeLabel");}

View 3 Replies

ActionScript 2.0 :: Putting Together A Tweened Preloader That Runs In Time With Bytes Loaded?

Nov 4, 2004

I'm over here putting together a tweened preloader that runs in time with bytes loaded. I'm just wondering how I could make the preloader movieclip fade out when the tween is finished and then advance the playhead when the alpha reaches 0. I can post an fla if that'll help anyone understand better.Heres the code on the preloader movieclip:

[Code]...

View 4 Replies

Flash :: Timeline Code To Object Oriented Code - Access Instances Already On Stage

Jan 12, 2011

As stupid as my question might sound, i have spent the last 2 weeks reading oop books; but could use some guidance. I have a flash project that is basically a supped up slide show. On the stage i have the following: main_mc (instance name = images_mc) = movieclip which holds "pictures" ui1 (instance name = ui1_mc) = user interface that allows user to draw on picture (when drawing is enabled) ui2 (instance name = ui2_mc) = activates invisible hit areas (buttons) on select pics, when hit area is clicked, we jump to another pic in the main_mc.

I accomplished all of this on the timeline, but am updating the code to OOP. I am having A HELL OF A TIME trying to figure out how to store references to the instances (images_mc etc..), so i can control them from varying class files. I have found it is easy to control the instances from the documentclass, but not from unrelated class files. Example: images_mc.stop(); works in document class; but ovieclip(Parent).images_mc.stop() doesn't seem to work from any class file.(ui2 class file for example);

[Code]...

View 2 Replies

ActionScript 3.0 :: Way To Have Main Timeline Code Interact With Code Inside Of Symbol.

Jan 29, 2012

I'm looking for a way to have my main timeline code interact with code inside of a symbol.I'm tying to get my timeline inside the symbol to gotoAndPlay(10) when something happens in my main timeline code.

View 3 Replies

ActionScript 3.0 :: Timeline Code And Separate AS File Code Working Together

Dec 27, 2010

Is there a way to make code on the timeline and code in a separate AS file communicate with each other?I have two buttons, a yes button and a no button.I have a confirm box which is a movie clip. In the movie clip I have the two buttons on it and code so that every time one of the buttons is clicked it runs a function.I have the rest of my code for the movie (so the code to make the confirm box appear) on a separate AS file.Is there a way I can define the functions on the movie clip and run the functions with the separate AS file?

View 7 Replies

Movie Clip Within Main Timeline Runs Slow/choppy First Time Around, But Not Second Time?

Dec 11, 2009

I have a fairly complex animation movie clip within my main timeline in a Flash file.  When you click a button, it plays the movie clip, then goes back out to the main timeline.  The first time the movie clip runs, it plays choppy and slow, but if I play it two or more times, it plays correctly (smoothly).  Is there some actionscript I need to preload the movie clip, or some other solution to the first-run slowness? 

View 2 Replies

ActionScript 3.0 :: Loaded Swf Tell The Parent Loader To Unload Itself After The Loaded Swf Finishes Playing?

Sep 23, 2010

I have a shell swf that is loading a swf. How do you have the loaded swf tell the parent loader to unload itself after the loaded swf finishes playing?

View 4 Replies

Flash :: Loaded Font Doesn't Show Up When Parent Swf Creates TextField In Loaded Child Swf

Jun 14, 2011

Im working on a project that has a main swf file associated with the document class. It loads XML that provides the text content for the project, then it loads a swf that contains a font in its library, then it loads the first of several content module swfs. When the font swf has inited, I'm registering its library font with Font.registerFont(), and using it in a TextFormat object. After everything is done, I can add code to the document class to create a text field on the stage of the main swf and format it successfully with the TextFormat object, but when I try to do the same thing inside the loaded content module swf, the text doesn't show up there at all.

View 1 Replies

ActionScript 3.0 :: Loaded Font Doesn't Show Up / When Parent Swf Creates TextField In Loaded Child Swf

Jun 15, 2011

I'm working on a project that has a main swf file associated with the document class. It loads XML that provides the text content for the project, then it loads a swf that contains a font in its library, then it loads the first of several content module swfs. When the font swf has inited, I'm registering its library font with Font.registerFont(), and using it in a TextFormat object. After everything is done, I can add code to the document class to create a text field on the stage of the main swf and format it successfully with the TextFormat object, but when I try to do the same thing inside the loaded content module swf, the text doesn't show up there at all.

View 7 Replies

Professional :: Runs On Harddrive But Not On Webserver?

Feb 5, 2011

I used the 'Advanced Slideshow' template in Flash CS5 to create a photo gallery. The images in the template are not placed inside of the project but are separate files (the photos). I tested it on my harddrive and it works perfectly. Then I uploaded it to my website and it doesn't show the images. The folder structure is the same as it is on my harddrive, all the files are the same.

View 9 Replies

ActionScript 3.0 :: A Frame Runs Code Written In Another Frame?

Aug 5, 2009

a mouse click calls a function that fades out a textfield in a frame, go to another frame and fades in the textfield that is in that frame.

Code:
function changeFrame(e):void
{

[code].....

View 2 Replies

Professional :: Flash Not Running In FF But Runs In IE And Chrome?

Nov 14, 2011

I am having an issue with Flash not running in Firefox but it is running in IE and Chrome. The main url is [URL] on which there is a section called "ROI Calculator". The download button links to a flash program which opens up in IE and Chrome but does not open in Firefox. I am using windows 7 professional and Firefox 8. Here is the code for the page [URL]:
 
<!-- saved from url=(0014)about:internet -->
<html lang="en"> 
<!--
Smart developers always View Source.
&#160;

[code]....

View 6 Replies

Professional :: Make An Flash EXE Autorun CD Which Runs On Both Mac And Windows?

Jul 22, 2010

I checked the forum and couldn't find an idea on this.I have a Flash .exe and also a MAC .app for my project. I need to autorun these when the CD is inserted.If it were a single .exe and if i wanted to load it in windows machine it would be a piece of cake.But I have 2 files, and I wanna load it from a single CD. If the system is Windows I want it to load the .exe, and if the user system is Mac i want it to load a .app. How do I program the .inf file now?

View 1 Replies

Professional :: Flash Player Games Runs Very Slow On Windows XP SP3?

Jun 5, 2010

I have problems with flash games and some advanced flash applications.Problems occurs regardless of browser.My computer is next:CPU: 2.8GHz hyper threadRAM: 1.5 GB (3 pieces)GPU: Nvidia 7600 GS Gigabyte.When it runs some flash game e.g. Facebook Pet Society, CPU load goes high as 80 to 100 %. It is very annoying thing since I am starting to loose my mind how to solve this.All other applications are running very good. This means games, 720p HD videos etc etc.

View 1 Replies

Professional :: Can Load All Images First So That Rest Of The Slide Show Runs Smoothly

Jan 22, 2010

in XML gallery , how we can load all images first so that rest of the slide show runs smoothly
 
For example:  I have placed 10 images in XML , when slideshow starts , all the effects not appears , because it waste time in loading each image on its turn  I want to load all images first , then want to start the slideshow how i load all  images at the start  ?

View 3 Replies

Professional :: Find A Method Of Increasing The Resolution Of An Executable That Runs Off Flash?

Feb 28, 2012

I've been trying to find a method of increasing the resolution of an executable that runs off flash. To be specific the program is a game called 'Realm of the mad god' originally a browser game but is now also a free to play steam title, Having browsed through the config files I couldnt find anything talking about resolution and I was wondering if there are any advanced flash features that allow the user to force the application to run a specific resolution.
 
PS: I don't have the highest hopes but I thought if anybody knew it would be someone from the flash community.

View 1 Replies

Professional :: Accessing Timeline From Class Loaded Into Doc Class?

Jun 12, 2011

I can't find a way to directly access a MC (or textfield, etc) on the timeline from a Class loaded into my Document Class. No problem from the Doc Class, but can't do it directly from the loaded Class. Is there a trick to essentiall extend the Doc Class AS from another external class?

View 7 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved