ActionScript 2.0 :: Call A Function With Parameters From XML?
Apr 16, 2010
I'm having a problem with a menu that is loaded from a xml file. I want to control the onRelease action for every button in the menu from one XML file, but I can't seem to get it to work... The buttons in the menu each have to call a different function with parameters which are declared in the flash file. The trace output shows the right function call, but it just won't fire the function.
This is an example of one of the nodes from my XML file with the function as node attribute:
PHP Code:
<locatie menu="LOCATIE )" label="LOCATIE" functie="showTextpage(myObj.locatie, CurrentProject)"> <image></image> <text></text> </locatie>
And this is my AS which loads the XML and sets up the menu:
PHP Code:
[Code].....
View 5 Replies
Similar Posts:
Jun 23, 2009
is it possible to store a list of params needed for a function in an array and then use that in a funciton call?
[Code]...
or something like that?? Prob have to iterate the array but how do i get the params into the function call? Is this even possible?
View 6 Replies
Oct 4, 2010
Let's Say I Have This Class:
package{
import flash.display.Sprite;
public class Main extends Sprite{
public function Main(){
trace(getAverage(1,2,3));
trace(getAverage(1,2,3,4));
[Code]...
View 5 Replies
Jan 14, 2010
i have one movie clip named one_mc.And i have one function named thisFunction.to add an event listener, i would code:
one_mc.addEventListener(MouseEvent.MOUSE_SOMETHING , thisfunction);
1) I want to show a box containing some text when the mouse is OVER it. Of course, when its not over, the box should not appear
2) I want to give parameters to thisFunction in order to use it, the way i prefer!
I must make one eventlistener for MOUSE_OVER and another for MOUSE_OUT? How do I pass parameters for the function when i call it?
View 3 Replies
Apr 7, 2009
I have this custom right-click menu. I need to call the reactOnClick() function with a specific parameter when clicking a specific right-menu item. I want to avoid multiplying the function for each right-click item.
Code: Select all//set up the custom right-click menu
rcnMenu = new ContextMenu();
//the value below is here just for testing purposes,
//the actual value could be anywhere between 3 and 13
var numberOfItemsTakenFromXml:Number = 5;
[Code].....
View 1 Replies
Feb 27, 2012
I have to call a .swf having parameters from another flash file. I made this using:
var context:LoaderContext = new LoaderContext();
context.parameters = {
'param1': 'foo',
'param2': 'bar'
}
loader = new Loader();
[Code]...
But now I have the need to embed the .swf, not dinamically load from an external url.
View 2 Replies
Sep 3, 2010
I'm having some trouble passing parameters with a function that is itself being passed as a parameter.In my application code I'm instancing that class five times:they are buttons in a menu.In that class, I've got an onRelease handler that does a number of things when a button is released, one of which is to invoke a function that is defined in the application level of the code.My problem is that I don't know how to send the function parameters.In my StandardButton class I have:
class StandardButton extends MovieClip
{
/* define properties */[code]..........
The function is successfully being "sent" to the StandardButton class, but without any parameters.How can I send parameters to the class instance with the way I've got this architected.
View 7 Replies
Oct 28, 2009
I just posted a message asking how to call a method from the constructor which has the parameters e: Event. I mistakenly ticked that post as answered when in reality it isnt. I was told I could add = null in the parameter of the function to make it work, like this:
[Code]...
View 5 Replies
Oct 27, 2011
i want to call a function on a soap-webservice using actionscript 3.the function has multiple parameters each of different type (int string).
this is the as-code i have so far.
var ws:WebService = new WebService();
ws.wsdl = "http://.../Service.svc?WSDL";
[code].....
View 1 Replies
Jun 22, 2009
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.
View 1 Replies
Jan 7, 2008
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();
}
View 3 Replies
Sep 25, 2009
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.
View 4 Replies
Nov 4, 2010
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.
View 2 Replies
Feb 10, 2011
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?
View 2 Replies
Feb 3, 2009
Does anyone know if there is a way to call a dispatchEvent call from inside of a static function?
View 2 Replies
Oct 13, 2002
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 Replies
Jan 31, 2011
I have a function in Flex which has three function in it.
public function update():void
{
A(); \Dispatches a event with Remote Call
[code].......
View 1 Replies
May 8, 2009
How do I make some parameters of a function optional?
For example in the function below, how do I make para3 optional?
function someFunction(para1:int, para2:int, para3:String){
}
View 3 Replies
Aug 13, 2009
I have some functions that have mouseEvents for their param and I am wondering how those can be use without the param. Meaning those functions where set up to work with buttons, but how can call those when I don't have a button to call them? Here is an example of one of the functions:
function forward(e:MouseEvent):void
{
ns.togglePause();
[Code].....
View 4 Replies
Nov 29, 2010
Something like[code]...
Since I have to loop through all of them. I can convert them to an array inside the function, but it would save me 10 lines if I could just enter them as an array in the function parameter (as I have 10 variables 1-10...)
View 4 Replies
Oct 13, 2011
So say I have a function that has some number of optional parameters but I don't like to write the function more than once. Instead just use for loop or such to iterate the parameters through and give them to that function.
Here's a raw scetch:
ActionScript Code:
// stylesheet for lines
var params1 = {
thicknes: 1,
[Code].....
View 2 Replies
Feb 3, 2006
way to say the same in just a few line of code? 25 lines of code people
[AS]menuAS = function () {
//TIOCCHA
menuBar.menu01.menu01_btn.onRelease = function() {
[Code]....
View 6 Replies
Apr 7, 2009
i am loading an image with a loader, and in onComplete function i would like to call calculateRatio function and pass it Loader.content.width and Loader.content.height so it can compare it with the current stage width and height and resize image proporcionally to fit the screen. how would i go about passing that parameters?
[Code]....
View 4 Replies
May 12, 2009
I have a hard time getting this
Code:
var whichXML:String = "category1";
loadFirstTime(whichXML);
function loadFirstTime(whichXML:String):void {
XMLLoader = new URLLoader();
XMLLoader.load(new URLRequest(whichXML + ".xml"));
}
View 1 Replies
Mar 4, 2004
{Flash MX 2004 Pro}
[Code]...
The above does not work. Infact the function is not even called. How can I pass parameters to such functions. I dont wanna do the following:
[Code]...
View 1 Replies
Jan 29, 2003
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;
}
View 2 Replies
Jun 16, 2010
How create baseurl function in flash and how i call that function in button script
View 1 Replies
Feb 28, 2008
I have this code but I cannot work out how to fill in function parameters based on an array and it's length, see line 7
[AS]
import com.robertpenner.easing.Cubic;
MovieClip.prototype.framesTimeout = function(func:Function, frames:Number, args:Array) {
[code]....
Is it possible to call a function and fill in the parameters based on an array and it's length?
View 1 Replies
Feb 26, 2009
Code:
function enableButtons():void
{
for (var i:uint=0; i<40; i++)
[Code]...
I have 40 buttons on the stage. Their names are contained in the Array musicGrid. What I'm trying to do with this code is attach an EventListener to each button so that it will call the function mgMouseBehavior with a parameter to identify the button. For example, I want the button at musicGrid[0] to call the function mgMouseBehavior(0). I want the button at musicGrid[32] to call the function mgMouseBehavior(32), and so on.
However, if you try to add parameters to mgMouseBehavior in the addEventListener, for example:
Code:
musicGrid[i].addEventListener(MouseEvent.CLICK, mgMouseBehavior(i));
Then you get Error 2007: Parameter listener must be non-null. How would I accomplish what I'm trying to do?
View 2 Replies
Aug 3, 2009
Well, I've got a problem, I don't know how to pass 2 parameters to a function by a aHref
called :
function derouler(num):void{
num=num.text; // rre la valeur de l'event
[code].....
View 3 Replies