ActionScript 3.0 :: Pass An External Object Between Functions?
Feb 9, 2010
I've got this external class that I'm loading into a function, it traces. But then I try to use the already loaded class in another function it tells me that I'm trying to access something that's not defined[code]...
View 0 Replies
Similar Posts:
Oct 25, 2011
Im adding lot of simple functions to prototypes of top level objects ( Object , Array , String ...) and have 2 questions :
Is possible to add functions to top level's classes in compile-time ?
If not , is there a way to allow this functions to compile ? I dont like to turn off strict mode
ex:
string.removeWhiteSpace();
string.sliceStr("." , "end");
textField.scrollBottom();
this return compile-time error , cause there is no such function , i have to write it in braces :
string["removeWhiteSpace"]();
string["sliceStr"]("." , "end");
textField["scrollBottom"]();
and i like to aviod it )
View 2 Replies
Sep 8, 2011
I am really pulling my hair out with this one. Flash game, container swf loads a img using the loader class. The image is the map which will be used on the levels. The problem im having is that I originaly had each level load the map image, convert to a bitmap, and us it to create x and y's for colision detection.
the problem was that the game was loading and sometimes the map image hadent loaded. It also ment that each level was loading the same image and if the above happened on the 3rd, 4th level it was very annoying. So I need a way to load the image in the parent, but have it available to the child, however it must be available as at bitmap to work.
[Code]...
View 1 Replies
Oct 28, 2009
I'm having to pass data (originally read via an XML file loaded by the parent class) to a child class upon instantiation, and I can't decide which is the better method.I could parse the XML in the parent and throw the data into an Object and pass that object to the child class....or just pass the part it needs as an XMLList and let the child class do the parsing.Seems like a trivial decision, yes, but I'm not sure of longer-term implications.
View 3 Replies
Jul 19, 2009
I know PHP, JavaScript and AJAX. All of these other languages easily allow me to pass variables through a function, but I can't seem to work out how to do it in ActionScript 3. As you can see from the code below, I have created a variable called 'flag', this variable is set to 'notAdded'. However, once the function is called, I want to change the variable to 'added'. This for some reason does not work, the variable update only works within the function itself. There seems to be no global scope for functions.
Code:
var flag:String = "notAdded";
bobRunning.addEventListener(MouseEvent.MOUSE_UP , bobRunningUp);
if (flag=="notAdded"){function bobRunningUp(event:MouseEvent):void{ bobRunning.width = 30;
bobRunning.height = 30;
flag = "added";
}}trace(flag);
View 5 Replies
Jul 19, 2009
Pass additional parameters to this type of functions?[code]...
View 1 Replies
Sep 12, 2010
I am trying to set up a function that makes the hit areas for buttons. The text is visible, but the hit area rectangle underneath the text is not, but detects the hit; my previous version, the mouse had to be over the actual descenders and ascenders of text to register, to the rectangle makes it easier to click. I have the invisible part of the hit areas visible right now, by commenting out the line to make them invisible, but the end result will have them invisible. Instead of explicitly defining every rectangle, I am successfully passing the x,y,height, and width params to newbut function. But I also want to pass the names for each button, otherwise it seems to just change the coordinates on the same button. I am trying to pass the names as strings, but not working. Not sure what to do!!! PS this is my first time on this or any other Flash board, so please be gentle.[code]...
View 3 Replies
Jul 10, 2010
I have a function fooA(valueA1, valueA2) which calls web method myWSA(). Upon reeiving the result, it invokes a result handler which inturn calls another web service myWSB(value2). I want to know how I can pass/access this value2 into foo2. These values: value1 and value2 are dependent on the button clicled.[code]...
View 1 Replies
Feb 1, 2010
I'm starting to get a handle on some AS3 basics in terms of building nested classes or packages or whatever the proper syntax terminology is.
Now I have two instance functions:
1 - parseXML
2 - loadImage
I have these 2 functions working together using an eventHandler. Once the XML is parsed the aim is to load an image. Sounds pretty common right?
When the image loading commands are in the parseXML function they work fine. But then when I put the image loading commands in separate function titled loadImage and trigger it using an eventHandler onComplete, it loses my variable and instance definitions.
View 0 Replies
Oct 21, 2010
how you pass and receive an array through functions in AS3? I keep trying it the same way I do in C# and it doesn't seem to work the same.Im trying:
Code:
Var aTest:Array = [1,2,3,4,5,6,7,8,9];
Testfunction(aTest);
Public Function Testfunction(aTestArray:Array)
[code]...
View 3 Replies
Apr 22, 2008
Way to call a function that DOES NOT accept arguments.[code]...
How about the SHORTER way to call a function that ACCEPTS arguments?
View 2 Replies
Oct 16, 2009
How do you pass variable values between functions where the addEventListener is in the first function? I am trying to get the color value passed into my event handler. [code]...
View 6 Replies
May 5, 2011
I don't know if this is possible with Actionscript 3. What I want to do is have a loseAll(); function that calls other function that in turn close sections of an application. I would be easier to have all the close functions in the closeAll() function and then pass a reference to the once that i don't want to be called. something like this.
[Code]...
View 2 Replies
Sep 30, 2009
I need to be able to communicate between two applications that reside on the same machine. One is using Flex and the other is in C++. I would like to be able to call functions and pass arguments to each other. What is the best way to communicate between them?
View 3 Replies
Jan 22, 2011
There are two files in my actionscript project named "TestAPP", TestAPP.as and Draggable.as
TestAPP.as:
package {
import flash.display.Sprite;
import flash.display.Stage;[code].....
In "my actionscript theory", I'm supposed to see a circle that follows the mouse when I click it. (The draggable is not fully implemented) But the circle doesn't even budge .how to access the main class's stage property. I've googled for it, but still no progress.
View 4 Replies
Jan 18, 2011
So I have two movie clips linked with classes- one with the class "theList" and one with the class "challengeBar". I need to use a function in challengeBar to access a function in the theList. They are both immediate children of the stage.so for now I have this (in the challengeBar class)-
public function populate(){
this.textBox1.text = myList.dequeue();
}
should it be something along the lines of root.myList.dequeue? or stage.myList.dequeue? How can I access that function?
View 2 Replies
Dec 17, 2009
The Context of the Problem.I'm working on a rotator banner in flash. I use an external xml file to pass the banners info (like info-text, link, image-path, priority, etc). Everything is going well so far. I'm loading the xml something like this:
var bannersXML:XML = new XML();
bannersXML.ignoreWhite = true;
bannersXML.load("myBanners.xml");
The Problem itself.Now I need to construct this xml on-the-fly in php and somehow pass it to my flash object. So instead of read the external file I want my flash script receive an xml parameter it can work with.
View 1 Replies
Nov 24, 2011
I have an object on stage that when I want to click it start to move cross the stage. But I get error:"Scene 1, Layer 'Layer 1', Frame 1, Line 41136: Incorrect number of arguments. Expected 1."
function animate(evt:MouseEvent)
{
animate1();
[code]......
View 2 Replies
Aug 3, 2011
Im going to develop an FLASH App to use an external SWF file as a reference to call its methods & functions.
View 0 Replies
Aug 19, 2007
its a site about interior design. my job is to add some code to do something. i checked the code and his approach is not so good.. he's coding inside objects and frames at the same time. (ive read many actionscript books and this is a really bad practice). Here's the problem... he wants this to be implemented in the site...1.) in the gallery there is a scrolling thumbnails, he wants this to pause about 4 seconds then it will start to scroll..(ive already fixed this by creating a function interval.
Here is where my problem is...2.) When you click the thumbnail, the enlarged view will pop up.. the enalarged view are external swfs... the client wants that when you click on the thumbnail, the scrolling will stop and the external popup enlarged image will come out...this external swf has an exit button to go back to the main gallery window which is another swf... so the client wants that when you hit exit from the external swf popup window, the scrolling will resume.... im having a hard time figuring this out because i dont know how to call a function from an external swf to the main movie (the gallery page) Ill post the fla of main movie, gallery and a single external swf link of the thumbnail. just click on the first picture that will appear on the gallery
View 1 Replies
Feb 24, 2010
I'm trying to get a link to an XML file passed from the Object Embed code into my Flash movie. (Not using SWFobject). I have 1 swf file that should be able to connect to 3 different XML files.
Below is the HTML code (I'm trying to get theXML path):
<div class="left">
<h2>300 x 353 Green Accent Color</h2>
<script type="text/javascript">
[Code] .....
Right now it's not loading the XML file from the param.
View 3 Replies
Feb 19, 2011
I am trying to figure how to pass string value(url) from html form to embedded flex object.the only method i found so far is "addCallback" method described in [url]...
View 1 Replies
Dec 10, 2009
i only know AS2, and was not doing actionscript for a while. i can't pass the variable to the object, please check what's wrong with my script. i want to put a variable after the obj. so when it randomize, it pass the random number after the obj.
obj1._visible = false;
obj2._visible = false;
function reveal() {
[Code]....
View 5 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
Mar 9, 2011
I am developing an air application where I have to drop an image and save the Image path, width, height to variables and pass those variables to external swf. I load the swf like this:
var myLoader:SWFLoader = new SWFLoader();
var url:URLRequest = new URLRequest("myExternalMovie.swf");
myLoader.load(url);
I am getting this error: the way I am passing the URL of the swf is incorrect and not supported in AIR.
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
Dec 18, 2009
I would like to know how to create an object-orientated functions in Actionscript 2. I'm actually not sure if that is what it's called...Anyway here's an example of how I want to be able to call my functions[code]...
View 2 Replies
Aug 4, 2009
I'm new to the object oriented stuff and I'm trying to learn how it works. Here's what I've started on - it's led to a few dilemmas. I have one flash file and two .as each with one class. In the timeline of the fla file, it reads:
ActionScript Code:
var FileObject:ScriptFile = new ScriptFile();
function onEnterFrame(){
FileObject.CallInput();
}
Call input is a function in "ScriptFile.as" that calls another function in "Input.as";
ActionScript Code:
class Input{
public function Input(){
} public function keyListener(target:Number):Number{
[Code] .....
In output, when I press Left, it will say -5 over and over again, and I'm trying to add to xpos value but that isn't happening.
View 1 Replies
Mar 25, 2010
I have a Main.fla which loads Main.as as its document class. In Main.as I have a public function named "Main" which runs a trace. I also have another .as file called Preloader.as, which also has a public function in it, this one named "Preloader" with simple trace in it. I just cannot figure out how to use Preloader() from the Preloader class in Main() from the Main class. Main.as loads up fine when the SWF loads and traces.
View 10 Replies
Sep 29, 2009
how i should be executing external functions from a .swf loader...here's my loader function:
Code:
on (keyPress "e") {
_root.createEmptyMovieClip("container", 1);[code].......
i can easily load the swf into the frame, but the colors don't change. Playing coloreffects.swf on its own works fine, just not through the loader. I imagine this is because you can't just operate two levels of AS2 at once...
View 7 Replies