Actionscript 3 :: Access To The Object (or Function) Who Call?
Mar 15, 2010I've asked this same question with Python. Now I like to know if this can be done in AS3.
If I have something like this:
[Code]...
I've asked this same question with Python. Now I like to know if this can be done in AS3.
If I have something like this:
[Code]...
is it possible to write a function to move an object and then call that function on a clip event for instance
function (bounce){
script;
script;
}
and then call it by saying
on(mouseOver){
this.bounce;
}
I have an AS3 program that calls a function multiple times. The function must return multiple variables, so I created a class for the function to declare an object containing all of these variables. For example, here's my class:
package
{
public class PER
{
[Code].....
Let's say the calling program calls the function, which returns the variables into data_set1 (where data_set1 depends on input variables arg1, arg2, arg3) using:
var data_set1:PER = function_name(arg1, arg2, arg3);
The calling program does some stuff, then calls the function again, but returns the variables into a new variable name, data_set2:
var data_set2:PER = function_name(arg4, arg5, arg6);
My intention is that data_set1 and data_set2 are different (e.g. not linked together).
My question is, given that arrays are passed by reference, will data_set1 be modified to agree with data_set2 upon the 2nd function call? Why or why not?
I create a swf with flex. Than I embeded that swf into aspx page.But how can I access/invoke/call swf function from asp.net???
View 1 RepliesI have a movieClip named MC, and it's enabled with action script, with the class name MC_Rectangle and a Stage.I override the MC_Rectangle class file in a mc_rectangle.as external file.here is the code:
package{
import flash.display.*;
import flash.events.*;[ code].....
I have new a object in the main stage var
mc_rect:MC_Rectangle = new MC_Rectangle()
in main stage:
1. how can i access the variable "sequence" in "mc_rect"
2. how can i pass parametre from main stage to mc_rect via function setSequence(data:int)?
3. how can i call the function in addSequence() in mc_rect.
in asp.net, i usually use mc_rect.sequenct,mc_rect.setSequence(data), mc_rect.addSequence() to achieve my goals......btw, can function in mc_rect return out result to main stage?
I have a swf that should be able to load another swf in runtime. Then I would like the loaded swf to call a method of the parent, loader swf, like this:
Code:
parent.closeForm;
But when I compile it, it throws this error:
1119: Access of possibly undefined property closeForm through a reference with static type flash.displayisplayObjectContainer.
I've tried:
Code:
if (parent != stage){
parent.closeForm;
}
So flash won't run this code at compile time, but it always throws that error. Here is the code of the LOADER swf:
Code:
private function loadForm():void {
var loader:Loader = new Loader()
var mRequest:URLRequest = new URLRequest(formPath);
loader.load(mRequest);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onFormCompleteHandler);
[Code] .....
How could I write an expression that should call a function of the LOADER swf without having this compile-time error?
I am trying to call a Jscript function from a flash object. I want the function to be called when the animation ends.
Here is the embed code
<h1 align="center">
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
WIDTH="360" HEIGHT="250" id="Yourfilename" ALIGN="center">
[code].....
here is the action code I add to the last frame of the flash object
URLLoader("javascript:mainFunction();");
The object loads but the function is not called. I can call the function other ways such as using an "onclick = mainFunction()" event on a button for example.
I need to call an object or function name with string variable.[code]it's working but, if I do something like below its not working [code]
View 2 RepliesI have an object and would like to call a function from it, which the way I am trying to do it, does not seem to work. Here is what I have:
Code:
private function setTimer():Void
{
[code]......
I'm trying to call a function that will slowly move/fade an object and it doesn't seem to want to work.
Here is the code
Code:
mypos = 1;
position = function () {
mypos++;
[Code].....
i have some actionscript that makes a
ExternalInterface.call('someFunction');
call.is it possible to reference the html object that made the call to someFunction directly using the ExternalInterface.call call?
Assume that the object that makes the call also has some Callbacks (via ExternalInterface.addCallback) that are accessible via javascript.
Currently:
Actionscript source
ExternalInterface.call("someFunction");
ExternalInterface.addCallback("someCallback",someASfunction);
[code]....
how to retrieve these in other functions.
In my main class (package) I have a function (tipTrendHandler) which creates an object TextBox. The instance in the example is ttrend. The class is imported. However when trying to access the object and apply e.g. a method, declared in another function (e.g. displaySequence) it seems this object is unknown.
ActionScript Code:
package com {
import flash.display.*
import com.mycompany.TextBox;
[Code]....
I am making a Scrollbar component and I want a script to call a calculation function for resizing the scrollbar when a new data is loaded.I was experimenting with Object.watch but it's use is beyond me. I don't understand if its the thing I need.Can Object.watch call a function when say a dynamic textfield's data is changed?
View 13 RepliesI am trying to access a shared object declared in a certain function, from another function. I am having
difficulty doing so. My code are as follows:
Code:
//Constructor code
public function EventTest()
{
[Code].....
I'm using an onLoad function (importing variables from a text file) and I'm creating arrays within a for loop in the onLoad function.
I'm using something like this:
Code:
this["dvdAry" + i] = this[indexAry[i]].split("##");
So say the first array is called dvdAry0 .
How can I access that Array from a function? Please note the function, the onLoad function and the arrays are all being created on the same timeline.I've tried tracing the array dvdAry0 from the function after the array is created in the onLoad function, but it comes up as undefined. Is the array created on the object that I'm using onLoad on?I'm using a loadVars Object called loadDVDsText.
I have a custom function that doesn't function correctly the first time the function executes it removes a textFiled from the display list without a problem but the second time that it executes it won't remove a diffrent textfield and I don't know why here is the code from the time the textField is added to the diplay list to where its deleted.Btw the function in question is being executed by a custom event listener.....the errors i receive are TypeError: Error #1009: Cannot access a property or method of a null object reference...Also note that i can remove the textField in question from any function other thatn the one the custom event executes.
PHP Code:
sendBtn.addEventListener(MouseEvent.CLICK, sendMsg0,false,0,true);
msgOut.addEventListener(KeyboardEvent.KEY_DOWN, sendMsg1,false,0,true);
comboBox.addEventListener(Event.CHANGE,chFontSize,false,0,true);[code]..........
i am working on a project that has separate swf files serving as different sections (students, faculty, etc). for each section, on the first frame i have a combobox that lists the different values within that particular section. when a user clicks on the value, it takes them to the specific frame within that swf. there are two problems:
1. when the user selects a value, everything functions correctly but an error is thrown that says:
[Code]...
I'm more of a server-side and javascript programmer. I have never done much with Flash. I have a robust html form based on flash based swfuploader and I need to test it with Selenium 2 / WebDriver.The problem is, thatmovieContent.CallFunction('<invoke name="selectFiles" returntype="javascript">' + __flash__argumentsToXML(argumentArray, 0) + '</invoke>');\is not supported in Flash 10 ...What are we supposed to do ? If it was possible I could js.executeScript(script); But now I have to do some sort of movieContent.click() in my java junit/selenium tests but it doesn't trigger the select file window, it doesn't do anything.
View 1 RepliesI'm working on a function that replaces an existing movie clip with a symbol from the library and then designates an "updater" function for the new instance. I have the first part working as intended, but I'm not sure how to approach creating the "updater" function.I've considered using event listeners, but I'm not sure if that is my best option.The following is a excerpt from my code. This code is on the timeline of a movie clip. The movie clip is on the main timeline with an instance name of slideUpPanel_mc.
ActionScript Code:
var window_mc:MovieClip = window_mc; //window_mc as it exists on the timeline
var windowUpdateFunc:Function; //reference to updater function in window_mc
[code].....
I'm trying to use ExternalInterface.Call to call a JavaScript function to launch a lightbox window. So far I have this:
AS3:
flash.external.ExternalInterface.call("launchLB", "" + aUrl + "");
JavaScript:
function launchLB(url) {
alert(url);
[Code]....
I get the alert but I can't get the lightbox window to display. When my as code makes the ExternalInterface call I get what looks like a page refresh and a blank browser window.
I have an enterFrame action that I use on a graphic:
[Code]....
Because I want to use the above code more than a few times, I tried to make it a function.
[Code]....
But for some reason the function call does not work when I call it via an action on a graphic where initially the code worked when it was explicitly written and not called as a function.
Code:
onClipEvent (enterFrame) {
fadeOut();
}
why this is not working.I have an application with a new class I just created. The class loads, but will not call it's own internal function.
package com.parkerandkent.components.classic.photogallery {
import caurina.transitions.Tweener;
import flash.display.MovieClip;[code]....
"Test 2" will not fire here.And I get this error message:
CallTag.as , Line 10 1180: Call to a possibly undefined method init.
I need to get a javascript var in my Flash application. I like to be able to just set a variable in the javascript (client constraints) rather than define a function.
Can this be done? I am trying to use the ExternalInterface.call()
AS:
ExternalInterface.call("function(){return window.someVar}", null);
JS:
var someVar = "Test";
This does not work and I suspect it is because the ExternalInterface.call() does not like the anonymous function.
I have a function defined in JavaScript like so:
function fadeBack() {
alert("fadeBack called");
};
I call that function from my Flash file like so:
import flash.external.*;
flash.external.ExternalInterface.call("fadeBack");
This works in both Safari and Chrome, but for some reason Firefox won't ever call the function. Still, I can't figure this out. How can I fix it?
Does anyone know if there is a way to call a dispatchEvent call from inside of a static function?
View 2 RepliesIf I have three classes:
public class Example {
public function Example () {
}[code]............
You can see that the two last classes extend the first one, and both have the 'variable' property. In case that I have an instance of Example and I am sure it is also an ExtendedExample OR AnotherExtendedExample instance, is there some way to access the 'variable' property? Something like
function functionThatReceivesAnExtendedExample (ex:Example):void {
if(some condition that I may need) {
ex.func()
have a node that has an asfunction embedded - won't work. if I change the a href to a web page- it works fine. If I try to call a custom function it doesn't call it at all.
View 1 Repliesbecause it keeps saying that my object is undefined.object undefined error. i am trying to pass values from js to actionscript and then i embedded it. i tried to embed it using embed and object tags only, but the javascript functions are not working. It keeps saying that object is expected.
[Code]...
I have a function in Flex which has three function in it.
public function update():void
{
A(); \Dispatches a event with Remote Call
[code].......
make a circle object movie clip call ball and make a rectangle object movie clip call mc and paste this coding.
[Code]...
can anyone explain about the movement about D? the D is talk about the distance if i go -X,way my ball go ++ to +x?