ActionScript 3.0 :: External SWF Get Variable From DocumentClass?
Dec 9, 2009
I have a problem with my AS3 files .I'm loading an external SWF, from that SWF I need to change a Boolean var that was set in a DocumentClass.My main DocumentClass is:
Code:
package {
import org.papervision3d.materials.special.CompositeMaterial;
import org.papervision3d.materials.WireframeMaterial;[code]..............
View 2 Replies
Similar Posts:
Mar 2, 2012
I have some movie clips in the library of a FLash file, which has a document class. The movie clips in the library are set up (via Linkage) to have a BaseClass. The document class creates containers for the movie clips, which are created by a timer. The base class has a click event that removes the movie clips. My problem is, how to reference the container that's created in the document class, when i want to do so from within the base class.
View 9 Replies
Apr 5, 2011
This fla have just one frame with all objects in the stage.This fla have a DocumentClass.as to control all the things..It's ALL working perfect, BUT i can't put a preloader for the archive...I try a lot of things and o can't preloader the animation. i try a lot of tutorials in the internet and NOTHING! How can i do it?
View 4 Replies
Jul 17, 2009
I have navbar_mc on the main stage. Within navbar_mc is button1_btn How can i reference this button with an eventListener from the DocumentClass?I have the following in the document class:
this.navbar.button1_btn.addEventListener(MouseEvent.CLICK, clickHandler);
but get the following error when i compile: TypeError: Error #1009: Cannot access a property or method of a null object reference.also, there are many buttons within navbar_mc, how can i make an elegant switch statement function (in the DocumetnClass) for all of them. To reiterate, with an eventListener for each button, how do i reference the correct one from a single function, in this case clickHandler?
View 4 Replies
Jul 26, 2009
I have been at it for days now and don't know how to get this going. I have DocumentClass and I have a simple function which returns stage width. I now would like to call this function from othr class which exist within the same package as my DocumentClass. I am able to trace the stage width when I invoke stageWidth() function from the DocumentClassAs I to understand, if the function is public, and it is being accessed by a class that exist within the same package, I should be able to access the function withou any issues.nd If I declare the function as STATIC then it is global and can be accessed by classes from other packages what am I doing wrong,
Function that I have written:
public function stageWidth()
{
[code].....
View 14 Replies
Apr 13, 2010
I'm new to AS3 and am starting to use OOP in flash. However I run into some problems with accessing movieclips from other classes. I am creating a DocumentClass (like Lee Brimelow showed in one of his tuts) and from that class I want to completely generate the movie using other classes and such. However I run into a problem when I need to access movieclip properties from other classes. Here's an example of what I have:
Code:
Select allpackage{
import flash.display.DisplayObject;
import flash.display.Stage;
import flash.display.MovieClip;
import com.dreamline._root.*;
public class DocumentClass extends MovieClip
[Code] .....
How to add clips from my DocumentClass and access them in the flHandler class without having to forward this.dpStage as a parameter.
View 6 Replies
Aug 21, 2011
I have this main (document class) in a Flash project:
package {
import flash.display.MovieClip;
import flash.events.Event;
[Code]....
Now: if I pass a reference (ref) of the main class to Other and I add clippo as you can see in the first case, I can reference the movieclip clippo from the main (getChildAt(0) is "clippo" from the main). But, is there any way to use the second method (no ref) and do the same from the main class? I can see clippo onstage when Other creates it but I can't understand where clippo "lives" into the DisplayList.
View 2 Replies
Feb 17, 2011
I've got a simple program that consist of a document class and a buttonTemplate constructor class. I need to call a function called updateText that should be in the document class, when someone clicks on a button. So that after each button is clicked, it updates some text in my document class. My event listeners for the buttons are in the buttonTemplate class. My question is, how do you call a function in the document class from a constructor class? Here is my simplified code below
DOCUMENT CLASS
Code:
package {
import flash.display.MovieClip;
import flash.text.TextField;
[Code].....
View 6 Replies
Mar 17, 2011
I'm having this problem: I have an external fla (Dawn.as) and I want to instantiate the class from the external file into the main swf timeline, but when I try doing that I get an error:
ActionScript Code:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Code::Chapter/initialise()
[code].....
View 5 Replies
Jul 19, 2011
I have this very simple ImageLoader class:[code]this doesn't work anymore, because of the presence of the stage movieclips "preloader" and "imageLoaderClip".Which is the most common way to make the things work? I thought to pass a reference to the ImageLoader class as a parameter (eg I pass the preloader and the movieclip that loads the images).
View 10 Replies
Feb 8, 2010
I have 2 movie clips, one being loaded into a container MC via "loadMovie();"In the main movie there is a variable with no value, in the external movie there are 5 frames, each with a value to update the variable in the main movie.
IE: if on frame 1, global value = 1 / if on frame 2, global value = 2 / etc etc I'm familiar with passing variables INTO an external swf, but am stumped on how to do it the reverse way.
View 1 Replies
Sep 8, 2003
I want to load an external variable called name from a text file into a local variable in flash called my_str...here's what I have:
var loadText = new loadVars();
loadText.onLoad = function(success) {
if (success) {
[Code]....
I need to have the variable my_str available outside the function..
View 3 Replies
Sep 10, 2003
I have a LoadVars object called loadText in which an external variable is loaded from a text file. Now, the whole thing works, I just want to create a template to optimize the system, so here is what I need: The external variable (in an external text file) is called page1. I am assigning that external variable to a local variable (at this point the external text has already been loaded in loadText, of course):
[Code]...
View 2 Replies
Dec 5, 2011
I am migrating a bunch of projects which were built in Flash Pro to Flash Builder....The basic structure of those projects were an FLA which has a DocumentClass. That DocumentClass referenced various items on the stage...
Is there any way to duplicate this in Flash Builder? I know I can just embed the swc or swf and then access items via ThatDisplayObject.itemToAccess, but calls from outside will no longer work. I.e. if this project is loaded by a container, which then calls SubProject.itemToAccess...Or must I change all the mappings, or set getters/settings on the new Flash Builder project so that outside calls will access the items?
View 1 Replies
Jun 15, 2009
Trying to Change a value in a external swf file.
have a Dynamic text field called
text1 in the externalfile
in the main movie I have var my_loader:Loader = new Loader();
my_loader.load(new URLRequest("Menu.swf")); then I have in a function on a button click:
function loadMenu(event:MouseEvent):void [code]...
My Question is how can I change the text property in the external .swf file ?
View 1 Replies
Feb 15, 2010
I'm trying to load an swf game, and then repeatedly run a check to see if the game has ended by accessing one of it's variables. Reading the forums and searching the web has gotten me this far:
[Code].....
"testing" appears on the output window so I know it's being loaded correctly, the game is also playing correctly. When I run the game in debug mode, it shows that the variable _level2.LOCAL exists and has a value, but the main loop just keeps kicking out "undefined."
View 1 Replies
Mar 12, 2010
I want to pass external XML a variable. How do I do this?
WHAT I'M AFTER
- update my variable with COUNT XML
WHAT I'M NOT GETTING
- The integer to String values
- How to pass XML to a variable
time.xml
<?xml version="1.0" encoding="utf-8"?>
<SESSION>
<COUNT TITLE="starting position">-77777</COUNT>
</SESSION>
[code]....
errors:coercion errors and null references with anything I attempt.
View 1 Replies
Jun 24, 2009
I've created a Flash video player that I regularly embed into HTML pages and use flashvars to update the path of the video to be played. The variable that I reference is named "videoURL" and is passed as a flashvar using "'flashvars', 'videoURL=myVideo.flv,"
The problem that I am having is when passing that same variable into my SWF when it is loaded externally into a new Flash file. I load the child SWF into my main FLA using the Loader class and I am able to run a successful trace on my variable using "trace(MovieClip(loader.content).videoURL);"
Obviously, I can't overwrite the variable with "videoURL = 'newVideo.flv'" as I have not defined videoURL in the main FLA. So my question is, how do I target my child SWF and what method do I use to pass it a variable? I'd assume that the correct method would also allow me to call a function from within the child SWF.
I hope that someone can explain this to me as every "solution" I've come across either suggests using HTML or Javascript, references AS2, or simply doesn't directly address my problem.
View 7 Replies
Jun 17, 2010
I searched for external SWF and got 500+ results but i couldnt see what i needed.Lets say you have a basic SWF file which contains a ball whose instance name is ball.Is it possible to load this SWF and access ball by name?The issue i have is that lets say you have 12 different heads... I need to load these heads in when required.. but each head.swf has a sprite called skinColor. need my main movie to have access to the skin layer sprite so i can Tween it. SWFs have much more details, but the skin sprite is on the bottom layer... so i cant just "color tween" the entire SWF.
View 1 Replies
Apr 20, 2006
i have a gallery that when any thumbnail is pressed it implements the following variable:[code] Now im trying to acces that variable "thumb" in ProjectFrame.swf but i cant seem to do it. Anyone know how I can pass the variable out?
View 14 Replies
Apr 5, 2007
I think i am screwing up the syntax. let's say I have a global variable, like. _global.something = mymovie
And then, the code to load in the external swf.... loadMovie((something)+ ".swf", _root.ec); Well, it doesn't work, and I'm just not sure where to put the quotes, and how many parenthesis are needed. How do I use a global variable and access it for this loadmovie code?
View 1 Replies
Sep 20, 2009
I'm creating part of my code to only be executed if a textfile on my server says it's okay. textfile.txt = "Okay=1 or 0"
I can get it to display in a textfield, but I cannot figure out how to simply put it in a variable for further actionscripting..
So how do I get the text from my external file, into a variable:string?
View 6 Replies
Mar 18, 2009
If I have an external text file with a variable, (let's say it's called names) with a list of names,... how do I load that variable into an array in flash?. Does it have something to do with Split() to separate the different values on the list separated with commas?
let's say the external file is:
names=john, peter, veronica, alfred.
How do we load that in flash so we have something like:
[code].....
View 7 Replies
Oct 30, 2009
Im running AS2 on Flash CS4 for this: I've found a million posts on similar topics, but none seem to do what I want, even though I feel like its very simple. I've tried a ton of different codes and can't get anything to work. All I want is for Flash to pull a number variable from an external file, lets just say a txt for now. I then want to be able to use this variable for calculations within flash. The only thing I can get to semi-work is having a txt file that says MyNum=5 and then putting the following in flash: loadVariables("Test.txt" , _root);
If I trace the variable "MyNum" it will output the right value, but its as a string no matter what I do. My most recent attempt to get it to be a number is to put the following on a later frame:
var NewVar:Number = MyNum;
var NewVar2:Number = NewVar + 1
trace(NewVar2);
Despite hardcoding multiple variables to be numbers, the output I get is 51, which means its still displaying as a string. My other issue is that you have to wait several frames before the variable is recognized. Do you have to wait numerous frames to use these loaded variables? If so, is there a way I can code it so that flash will just wait until it has the variable before moving on? I can't seem to get any loading function to work for it, but I don't just want to pull my next action down the timeline some arbitrary number of frames and hope its enough for flash to pull that number from the file.
View 10 Replies
Aug 6, 2010
I have an external log file which name changes each session, with the format XXXXX.log
I need to load it inside a swf to show its data, but each time the logs name is different, I need to open the .fla, changing the name of the file and then republishing the swf.
So I have made a simple script to load another .txt, to type manually in it the 5 number of the logs name and load it externally inside the swf:
Code:
var logNumLoader:URLLoader = new URLLoader();
logNumLoader.dataFormat=URLLoaderDataFormat.VARIABLES;
logNumLoader.addEventListener(Event.COMPLETE, loadedLogNum);
[Code]....
While I cannot assign the value of logNum to the last function, the .log cannot be opened.
View 2 Replies
Jul 9, 2009
I currently have a flash video player and I want to add some code that will update a variable in an external .as or .txt file. I then want to be able to pull this variable into a different .swf when required.
My variable I want to create will be CurrentVideo and it needs to be a number e.g. _global.CurrentVideo = 2
View 1 Replies
Jul 30, 2009
I have a simple menu class for site navigation[code]...
I would like to be able to listen to the value of 'btnName' inside my .fla and respond accordingly.
Is it possible to pass this variable from an external .as file into my .fla?
View 10 Replies
Jan 13, 2010
I want to be able to load an external text from an http request to a string in my flash application.
i know that with loadvars i can load variables, when the output is as: key=value&key=value.. but this is not the case here. i get in return a string with several random characters. how can i properly retrieve them ?
View 1 Replies
Aug 4, 2010
I have an external log file which name changes each session, with the format XXXXX.log I need to load it inside a swf to show its data, but each time the log's name is different, I need to open the .fla, changing the name of the file and then republishing the swf. So I have made a simple script to load another .txt, to type manually in it the 5 number of the logs name and load it externally inside the swf:
[Code]...
View 2 Replies
Jan 28, 2010
So I have ClassA and ClassB. Each of these is the document class of two different FLAs. In ClassA I want to load a SWF and set it to a variable of type ClassB. The problem is that ClassB uses a ComboBox, so when I try to type the varialbe, then ClassA complains that it can't fine the definition for ComboBox. If I add the ComboBox component to the library of ClassA it works just fine. But that kind of defeats the puprose of me creating the seperate SWFs in the first place... smaller file sizes. So here is basic code of what I'm trying to do.
Code:
package
{
import ClassB;
public class ClassA extends Sprite
[Code].....
If I don't try to type the variable "swf" to ClassB then it works absolutely fine. But I want to have it typed so that I can then use intellisense/code completion in my IDE and not have to worry about the compiler telling em that functions don't exist on ClassB when I try to use them and such.
how to accomplish this? I have found that I can have ClassB implement an Interface and then set the swf to type IClassB... but I really don't want to have to do that because that means for all swfs I want to load I will have to create another Interface and prototype out all the functions. That just seems extremely tedious as this project will get very big.
View 2 Replies