ActionScript 3.0 :: Call Function From As File?
Dec 17, 2010I'm calling a function[code]...
View 3 RepliesI'm calling a function[code]...
View 3 RepliesIn short: how can i call a function in another .as file? Is there a way to make header files or forward declarations in AS3?
Output
Code:
BREAKPOINT1
1061: Call to a possibly undefined method playerCharMove
through a reference with static type Class.
game.fla layer 1 frame 1
[Code]....
I have a function called test in my first frame of my fla file all it does is trace HELLO WORLD
All i want it to do is call it in my AS file no I cant no such function exist?
[Code]...
my xml file is as such:
Code:
<menu txt="THIS ITEM FIRES A FUNCTION IN FLASH" txtcolor="0xFFFFFF" menuaction="myFUNCTION" />
myFUNCTION is a function inside of flash, how can i possibly trigger this?
i did some searches but i can't find the sollution:
i read upon asfunction:myFUNCTION, but it simply doesn't work
this is my relevant flash code
Code:
myFUNCTION = function()
{
trace ("am i called?");
[Code]....
I like to call a function that is outside of the class file.
for example
main.fla
Code:
function callmepls(){
trace("yes");
}
[Code].....
This is my main AS File. I tried to call the function onChangeState within the Main AS File to avoid that the _side.menuXXX addEventListener ist called when there is no such object. So i want the main as to call the onChangeState functionbut i always get this error[code]...
View 1 RepliesThe Situation: I have a main.as that has a function that is worth 400 lines.
What I want to happen: I want that function to be loaded from another .as file so that my main.as does not look too long. Also, I have a lot of variables that was instantiated on my main.as that is called on that 400 line function.
The Question: How do I do this?
My client says make this, and use XML so it's dynamic and easy to update:A text box with scroller holding news headlines, and a more link that will open an MC with the entire news article. Like:11/28/05 - X-Raided Celebrates 3 Years in Prison Folsom Correctional facility officers report that imprisoned rap artist X-Raided threw a party in his cell (with his cellmate) to celebrate his third anniversary in prison. Officials state.[code]
how to make that "more" link in the XML tell flash to run a specific function.I already have a function that makes whatever mc I want visible and I can write some code to fill in dynamic text boxes with the proper nodeData.But what would that "href=" have to be in the XML in order to call that function inside of flash. Is there a way you can turn XML data into executable commands?
I am trying to OOP my AS2 project to AS3. I have some global functions at main timeline and shared acorss many different objects. How can I call a common function within my class method? I don't want to maintain multiple copies. [code]...
View 0 RepliesHow to call a JavaScript function written in a .js file from action script in MX.
View 1 Replieshave this method within a class. It loads in an XML file, then attempts to call another function. For some reason however, the loadXML() does not execute. If I put a trace right before it, the trace executes. If I take that function out of the onload, it executes.
private function openXML (URL:String) {
var xmlData:XML = new XML();
xmlData.ignoreWhite = true;
[code].....
How can a function in main timeline be called from class file?
View 4 RepliesI'm loading from my main page an external js file, with a function.
I have a flash file in the main page invoking the javascript function.
Everything worked very well until when the javascript code was in the main file, but when I moved javascript to an external file the function seems not called anymore.
So... there is no way to move the javascript code to an external file ? Or any other solution ?
[Code]...
I have some functions defined at the main timeline, and I need to call them from a class, how can I do this?
I've tried object(parent).function();
and object(root).function();
but didn't worked
those functions need to be on the main timeline because they removeChild() of the class
I click on a button (or any object where I can write Action Script) and It should call a javascript function which I wrote in my functions.js
View 1 RepliesI have a movie clip with an actions layer. Can I call a function from an actionscript file from the actions panel?
View 2 Repliesi have a movie clip with an actions layer can i call a function from an actionscript file from the actions panel?
View 6 Repliesi want to call a javascript function from within an embeded swf file in a html page and i'm using the ExternalInterface class. i know this function must be defined in a <script> tag in the html page. however, i want to have all my javascript code in an external file, but it doesn't work. my trial file just can't find the function, although i have my external js file linked in the header.
View 3 RepliesI have small issue in as3. I am load "mainmenu.swf" file into "main.swf". through loader class. so now "main.swf" is parent "mainmenu.swf" file children how can call "main.swf " variable & function from "mainmenu.swf" .
View 2 RepliesI've a grid view in flex, one of the columns is rendered like this:
[Code]....
now I've a problem that the function in button click is not being recognized. It says "call to a possibly undefined function" even though it was defined. What is wrong with this? How do i make a button in a grid call a function in the same mxml file??
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 Replieshave 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 RepliesI am using in AS3 "External Interface ". When I call the JS function that is on the same page as swf everything works fine.
I added a link in the html page to an external JS file, when I move the JS function to the external JS file the website crushes.
I would prefer to have all my JS functions on an external file so I can use them in the future in other project and it also makes it easier for me to update the site.
how to call a JS function that is on an external file from AS3?
I'd like to call a javascript function from an embedded .swf file. Specifically, I'd like to call a function in one of my externally linked javascript files from within: function loadTrack(){
[Code]...
which is in an .as file which I assume somehow becomes the swf file. How would I go about this and 're-compile' the .as file?
I have a function in Flex which has three function in it.
public function update():void
{
A(); \Dispatches a event with Remote Call
[code].......