ActionScript 3.0 :: Accessing The Url From Which A Swf File Has Been Loaded?
Jan 6, 2009
finding the url of the swf filefrom which it has been loaded? The purpose of the url is, I amloading some flv files using relative path. I just want to achievethe same by appending the relative path to the parent swf url fromwhere the parent was loaded. I am a newbie to AS3
View 5 Replies
Similar Posts:
Jul 9, 2009
I have the following problem when loading a swf file. I have content.swf file located at [URL]. The contetn.swf access a file settings.xml located in the same dir. I load it like this:
_settingsURLRequest = new URLRequest( "settings.xml" );
_settingsLoader = new URLLoader();
_settingsLoader.load( _settingsURLRequest );
Now I have another file loader.swf located at another domain [URL]. The loader.swf file loads content.swf but content.swf search for the settings file at domain2 not domain1. I know that I can use absolute address when loading the settings file but I'm loading a lot of files and I prefer another solution. Is there a way to specify that content.swf should always search for settings.xml in its own domain no matter the fact that its being loaded from onother file in onother domain?
View 2 Replies
Dec 28, 2011
I am trying to access a button inside an external swf file that I loaded. Problem is every time I try to access this button I get an error saying that it's null!
Here is my code:
public class DocumentClass extends Sprite
{
public var loader:Loader;
public var swfFile:URLRequest;
[Code].....
Now this should work, code-wise I think its correct. The problem is that loader cant find the required button. There is indeed a button in the loaded movieClip with an instance name of "button", I double checked that.
[URL] basically i was just a layer too high and this is why i couldn't access anything..
View 1 Replies
Jan 7, 2012
How do I get to the MovieClips within an externally loaded Movie Clip. Lets say I have a movie Called ONE in the swf I just loaded. How can I work with it alpha, position and other properties of the children of this clip? CODE IN MAIN TIMLINE:
[Code]...
Now its loaded I want to change the postino of the clip called ONE in the movie LoadedMC I just created.
View 1 Replies
May 16, 2009
in (swfA.fla) I have this code in frame1
var module1:Loader = new Loader();
var admin = new MovieClip();
addChild(admin);
[Code]....
(my thought here is that 'admin' contains swfB.swf?) - this would seem very simple... but it...
...does not work and gives me this [seriously unhelpful] error:
TypeError: Error #1010: A term is undefined and has no properties.
at swfA_fla::MainTimeline/frame1()
View 7 Replies
Nov 2, 2009
I am creating a web page that allows users to upload their own swf files to my web page, which are then used by the main web page as components. This creates a security issue though because I don't want the uploaded swf files to access other files on the server.
when the main webpage starts, it loads whatever third party swf files the user specifies. Is there a way for my main web page to change the security settings of the loaded swf so that the loaded swf is treated like it was loaded from another domain? Or is there another way I can provent these uploaded swfs from accessing local files on the server.
View 5 Replies
May 14, 2011
- I have A.fla.
- A.fla includes buttons, movie clips and also B.swf is loaded in A.fla using a LOADER
- i want to access elements in A.fla, from the actionscript codes inside B.fla to modify those movie clips and buttons based on actions going on in B.swf
for instance, lets say there is a button X in A.fla, and there is a button Y in B.fla, B.swf is loaded into A.fla, and I want the button Y to erase button X when clicked.
general question: accessing elements in a stage, through a SWF file loaded into that stage.
View 2 Replies
Mar 1, 2010
I'm writing a card game in AS3. The artist I'm working with has produced (in Flash CS4) a single swf-file containing all the card graphics and animations. The structure of the fla working file looks something like this:
- Scene
- CardGraphics (Movie Clip)
- CardFront
- CardBack
- CardValueImage (Movie Clip)
In the program I create 52 instances of my Card class, each having a MovieClip instance created from the loaded swf. The idea is to set the frame of the CardValueImage MovieClip to correspond to the Card instance's suit and rank member variables. However, I can't figure out how I access CardValueImage and call gotoAndStop (or whatever method I will need to call).
[Code]...
View 2 Replies
Jun 1, 2011
I'm using this code to bring in another swf into a movieClip called "movieLoader":
var myLoader:Loader = new Loader();
movieLoader.addChild(myLoader);
var urlMovie:URLRequest = new URLRequest("movie1.swf");
myLoader.load(urlMovie);
The movie loads just fine, but how do I access it?
I tried:trace(movieLoader.totalFrames);
and it just gave me "1". I know the movieclip has more than 1 frame.What do I do to access the swf called "movie1.swf" I just brought into that movieClip?
View 4 Replies
May 20, 2011
I'm loading an external AS3 SWF using the Loader class but i need to access a method inside the loaded SWF. how can i do this?
View 1 Replies
Oct 13, 2010
So I want to access another loaded SWF. How can I have ChildA talk to Child B? All are external SWFs.
[Code]...
View 1 Replies
Mar 30, 2009
I am using a zoom component which i purchased recently to load different external swfs on different button clicks. But instead of loading separate external swfs I would like to load a single swf and go to frame labels - "one", "two", etc. - I've been reading about casting the external swf as a movie clip, but I am confused how this would work with the code I have at the moment.
var image:String="introlocal.swf";
function loadContent () {
var myLoader:Loader = new Loader();
[code].....
View 1 Replies
Sep 15, 2008
I have a problem accessing a variable loaded from another swf. Actually the variable is a singeltone class, which needs to be initialized.It has structure presented in the last part of the message.The project has the following structure:
- main.swf - this loads all the other swf files and is their holder.
- assets.swf - contains some common elements and initializes the SingleTone class
- interface.swf - contains some interface elements and needs to use the SingleTone class
- all the three swf files have access to a common class structure, where the SingleTone class is defined.
Now, the problem I have is accessing the SingleTone class from the interface.swf file. If I try to send the SingleTone.singleTone. property parameter to the class I get "Type coercion failed: cannot convert from ClassName@.. to ClassName". If I try to access the SingleTone class directly from the interface.swf file i get "Cannot access a property or reference of a null object...". Both errors I get seem logical:
- if I send a parameter, I send the reference to that object, but the interface.swf file does not have access to the assets.swf domain;
- if I try to access the SingleTone class directly from the interface.swf file, I get the null error because the class is not initialized over the interface.swf domain.
Is there any work arround? I know a simple solution may be to initialize the variable over the interface.swf domain, but what if there is a variable that can only be instantiated in the assets.swf? Can I access that variable from another swf, or can I change the ApplicationDomain?
View 1 Replies
Nov 14, 2010
I am trying to load swf file with Loader class into AIR application. The broblem is that the loaded swf can not access web cam (it can when I run it standalone). Is there any security settings I have missed.
AIR loader code:
loader = new Loader(); loader.name = "moduleLoader";loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
[Code]....
View 3 Replies
Nov 23, 2011
In Flash Professional, I drew a shape, converted it to symbol, linked it to class Symbol1 (extends MovieClip) which is generated at run-time, and saved the SWF file as shape.swf.
Now my main application wants to load shape.swf and create multiple instances of Symbol1 but I get ReferenceError when trying to access the class Symbol1.
Below is my main application's code. Errors thrown are mentioned in comments.
public class MovieClipTest extends Sprite
{
public function MovieClipTest()
{
[Code]...
View 11 Replies
Mar 4, 2012
I have a SWf application built in flex 4. One part of the application relies on accessing a public variable ("step1") set at the application root, and is accessed with
var app:Object = FlexGlobals.topLevelApplication;
trace("step one is "+app.step1);
This, while not optimal, has worked fine. Now, hoever, I need to load this entire application into another application, and I can't figure out how to access my step1 variable any longer.I have been loading the swf into the new parent application like so:
public var myLoader:Loader = new Loader();
public var pizzaContainer:UIComponent = new UIComponent();
private var myUrl:URLRequest = new URLRequest("chickensoup.swf");
[code]......
View 1 Replies
Jul 1, 2009
I am creating a flash program to open other flash programs (load swf files), and change their textfields to my own extended textfield class. This is to capture all text written to screen using a textfield object. Here is what I am doing:
1. If a textfield has been created, the event is captured
2. I want to replace the textfield with my own class extending textfield
*3. Any further access to the original textfield for value changes can be captured, and would update the replaced extended textfield object
The problem is if in their original code, at sometime, the text value of textfield is changed (mainly through textFieldObj.text = some_value) , I don't know how to capture this event.
This cannot be captured by event.CHANGE which requires the user input (ie: keyboard strokes) into the actual text field and changing the text through the code: textFieldObj.text = some_value does not trigger the event.
Here is a simplified example:
// FlashMovie.fla START -------------------------------------------
// any DisplayObjects (such as a created textfield) created will be captured
// by ChildAdded()
this.addEventListener(Event.ADDED, ChildAdded);
[Code]....
View 0 Replies
Jul 22, 2009
I have a movie called crime_scene.swf that is loaded onto another swf.
Code:
this.createEmptyMovieClip("myContainer", 1);
var mclListener:Object = new Object();
mclListener.onLoadInit = function(target_mc:MovieClip)
[Code]....
It seems like it's not working. I tried just myContainer.evi_1.onRelease and _level1.evi_1 but nothing seems to work.
View 2 Replies
Jun 30, 2010
I have a file which loads a series of SWFs. It loads one, allows it to play to completion, then stops. Right now, it will just wait for the user to press a button and select the next one. However, I need it to play them sequentially. Is there any way for the SWFs which get loaded to access the functions which control the SWF loading?
View 4 Replies
Jul 14, 2010
Im loading SWFs into my AS3 application. My SWFS are all the same and contain this structure:
root
-item
--color
--overlay
When i load up a SWF file into AS3, This is analogous to the root. So i can say:
[Code]....
I have tried everything i can think of to access this second depth by instance name. Whats wierd is that MovieClip(loadedSWF.item).numChildren returns 2. So Flash knows that theres 2 MovieClips inside of item.... But it just cant reference them by instance name. Since loadedSWF.item works, i assumed that loadedSwf.item.color would work too.
EDIT: I seem to be able to access the MC via getChildAtIndex(0); However this isnt ideal because it create a rule for the designer that he must follow a layering order. Id prefer to do it by name.
View 0 Replies
Nov 23, 2011
In Flash Professional,I drew a shape, converted it to symbol, linked it to class Symbol1 (extends MovieClip) which is generated at run-time, and saved the SWF file as shape.swf.Now my main application wants to load shape.swf and create multiple instances of Symbol1 but I get ReferenceError when trying to access the class Symbol1.Below is my main application's code. Errors thrown are mentioned in comments.
ActionScript Code:
public class MovieClipTest extends Sprite[code].............
View 3 Replies
Jan 12, 2011
I'm having a SWF call functions from another SWF loaded in the first one with the Loader class. There are no problems as long as the target SWF does not contain any TLF TextFields created on stage by authoring time interface. As soon as I place a dynamic textfield on the stage of the loaded SWF, the main SWF (the loader) fails to call any of the functions within the SWF that is being loaded.Static text does not seem to present problems and neither do TextFields created via ActionScript.Also, is it possible to access variables of the parent SWF?
View 2 Replies
Dec 5, 2003
I am having a problem accessing variables in a loaded flash movie.
As my understanding goes (someone please correct me if I am wrong), if I load a flash movie into a parent movie (i.e. 'loadMovie("myMovie", emptyClip);'), I should be able to access the loaded movie's variables using dot-syntax.
As an example, say I have two movies: MainMovie.swf, and SubMovie.swf. SubMovie.swf contains a (global) variable called someText. After loading SubMovie into an empty movie clip called "emptyClip", MainMovie.swf should be able to access the aforementioned variable by saying "emptyClip.someText", right....? Well, when I try this I keep getting an undefined value for the variable.
View 7 Replies
Mar 25, 2006
I loaded an external swf into flash using loadMovie. The loaded movie has a hidden button which does some actions. How can I, by clicking on a button on flash execute the actions of the button which exists on the loaded swf?
View 1 Replies
Sep 8, 2008
I'm sorry if this has been answered 1,000 times, but I am so confused with everything!! In the main timeline of my movie, I have a container movieclip called "content". I want to load an external swf into content, and then access the functions in that swf. I can load it no problem, but I can't for the life of me figure out how to access the functions, I can't seem to find it anywhere!
View 3 Replies
Jun 22, 2009
I have 2 swfs, one is main and it loads other file "skin.swf". skin contains object of custom class SkinClass. I can access it from main swf, but when I try to cast that object, the result is null. This happens when I use absolute url, when I load skin from relative url, everything is ok.
View 3 Replies
Jun 24, 2009
I have successfully loaded an external swf inside my main swf. Now, I'm unable to try to trace a variable of the loaded swf from my main swf....
Code:
// Create site request
var siteRequest:URLRequest = new URLRequest('site.swf'); // 'site-' + siteAmbiance + '.swf'
[Code]....
View 6 Replies
Jan 17, 2010
I have a swf file which contains in its library couple pictures. After it is loaded using preloader I would like to be able to create couple instances of them and add them to the stage
If I use swc approach and import it in library path I can not preload it but instancing is very simple i.e
Code:
public var pic:Pic1 = new Pic1();
and that's it, I can add it then to stage then.
How to access them when doing it with swf and loader class?
View 1 Replies
Mar 30, 2010
I'm loading swf file from a server. For some reason i can't access movieclips that are not instantiated on the first frame, more than this - all movieclips that are not instantiated on the first frame and have some animation inside of them, won't stop looping, like there is no stop() action inside, but it is there. And even more than this - everything works fine when i'm using other server. Both servers have crossdomain.xml file that looks the sameI don't get no crossdomain errors and no other warnings.
View 2 Replies
Jun 8, 2010
Well, I know how to access the loaded swf variables from its parent, but how do I access the parent SWF variables from a loaded SWF?! I'm trying it.. But get no results.
View 6 Replies