ActionScript 1/2 :: Pass Parameters Into Flash Using A Javascript Function?
Jan 29, 2010
I am attempting to get Flash - Javascript communication working using ExternalInterface.addCallback, using code found at http:[url].... I am trying to pass parameters into Flash using a javascript function, but it only works if I insert a 'window.alert' line into the code. Once I click OK, the parameter str is passed into Flash ok. The function is:
function sendToFlash(str) { if (str=="tools"){ window.alert(str); getFlashMovie("richFunctionality_corp").sendTextToFlash(str);[code]....
If I remove the window.alert, str isn't passed into Flash. Is this a browser speed thing? A value menu is passed out of Flash using getURL("index.php?pageID=239&menu=tools"), i.e. the page reloads and a php script sends the appropriate str value to the sendToFlash javascript function based upon the value of menu.
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.
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")); }
I created a function to handle the size of a talk bubble for a chat application based on what's being loaded into the movie clip I want it to scale it's height that is. I have it working when like this
I think this is fairly straight forward but my skills lie in JavaScript and Ruby rather than flash so I want to run this past a few other minds :) I have a flash file that will take pictures of the user via their web cam. I want to take that newly created image, base64 encode it then pass it to a JavaScript function. That JavaScript function will essentially take this data then embed it into a hidden form element on the page.
I'm working with arrays in AS3 and some of the utility functions described in the livedocs such as filter() or some() would be very useful to me, if only I could pass parameters to them...
Actually, I cannot find a single example of the use of these functions with custom parameters passed to their callbacks. Everywhere, it is always used with constants ! E.g. on this page: [URL]
var arr:Array = new Array();var totalElements:uint = 100;for(var i:uint = 0; i<totalElements; i++) { arr[i] = Math.round(Math.random()*100);}function isLargerThan90(element:*, index:int, arr:Array):Boolean { return element > 90;}var highestNumbers:Array = arr.filter(isLargerThan90);trace(highestNumbers);
What I need is a kind of "isLargerThan" function with "90" as an argument's value, not as a constant. Something like
function isLargerThan(element:*, index:int, arr:Array, param:Object):Boolean { return element > (param as Number);}I find it very odd that I cannot find no mention of the way to do this on the whole WWW, because that makes these utility functions absolutely helpless in many many cases and programming with arrays a real pain...
I have already created a custom mouse event which seems to work fine. It is simply a mouse event which passes an additional sound object. The problem is I am passing this event to another class which checks for collision of a movie clip with another and if true it adds the sound to an array. What I think is happening is a type conversion problem between my customEvent and the MouseEvent. [code]...
I have a project that uses a lot of remoting calls and I'm hoping to abstract the process. I've hit a problem with passing parameters to the final call...[code]...
I know how to loop through the ...rest param to obtain their values but I'm struggling at how to construct the final gateway.call() which could have 1 arg or 10.
Code: addVolvo.addEventListener(MouseEvent.CLICK, addCar); function addCar(evt:MouseEvent) {
[code]...
... but I want to pass the a value when calling the function:
Code:
addVolvo.addEventListener(MouseEvent.CLICK, addCar(classVolvo)); function addCar(evt:MouseEvent, newClass:Class) { var car1:Car = new Car( 1, 1, classVolvo)
[code]...
This won't work. Because it then just passes the Class and not the MouseEvent. What should I write in the addCar(...) call function? Ie how to I manually pass an MouseEvent?
I've got a main.as that loads SWF to the stage. the loaded SWF seppoused to pass a link to the main.as and trigger a javascript function to popUp that photo from that link.
I know there are two ways:
((root as MovieClip).parent.parent as Object).somefunction(parameters);
and to dispatch an event. inorder to pass parameters throug the event i need to extend it with another class.
isnt the (root as... ) more efficient if all i need is to pass a link?
i have couple of videos that i want to play in succession. my theory on how to do this was to add an event listener that would call function to change the source of the FLVPlayback component and play once the initial video finished playing. The problem is that i don't know what parameters to pass to the eventlistener and the acting function. I just need someone to fill in the blanks to the following code
I want to be able to call a JavaScript function from a Flex app using ExternalInterface and pass a reference to a different JavaScript function as an argument.
A SWF can access parameters set in HTML via loaderInfo.parameters. How do I set this in a .fla project so that they are set when I run the SWF with ctrl-enter ?
I have imported the ShockWave flash Activex Control in my Delphi project. I can manipulate All the properties of a Flash movie file. But I need to define my own Parameters in the my own Flash file and Manipulate those parameters in the Delphi project. I know that passing parameters to a flash file is possible in the HTML script. But my project is a desktop application and i can't use it.
Is it possible to get a handle to the defined parameter of a flash file in the Delphi project? in fact All i need is passing parameter to flash file in the Delphi project.
In Flash CSn/AS3 you associate a Main class with a flash file which when loaded in the flash player "automatically creates an instance of the program's main class."I'd like to know how to pass arguments to the main class, since you don't write it yourself (you put its name in the Document textfield in the IDE).
system infoflash player version: 10_1_102_65OS: linux debian, 6.0.2web browser: Mozilla Iceweasel 3.5.16problem descriptionI have a flash file that uses parameters to show output on the screen. unfortunately i don't have sources and can't modify/review it.shows correct flash in the browser.but when i try to load flash from fileflash can't read passed parameter and shows invalid outputit's really strange. because when i downgraded flash plugin (from 10_1_102_65 to 9) both protocols works! That is something occurred in the flash player above 9.unfortunately i can't use Flash Player 9 in my production environment so i should resolve the issue with Flash Player 10.
var myWebService = new WebService(); myWebService.addEventListener("load", loadDone); myWebService.loadWSDL("wsdl_address"); var myOperation:Operation; function loadDone(evt:LoadEvent)
I've got a function wich can accept a varible number of parameter with a rest operator. I want create an object passing the argument collected with the rest operator directly to a constructor without create an object and call an initializing function and without passing the entire array but the parameters ah I do with apply() function.
I've created a Flash Animation (CS5, ActionScript 3) and converted it to SWF. The flash animation needs the values of 3 variables (defined in the swf timeline) BEFORE it starts running in my Flex application. I've embedded the swf file using swfloader in Flex, but I need to pass the parameters from Flex into Flash before the animation starts. How do I do this?
The way I have my flex code setup below, the variables are not being updated. I get an exception every time it gets to the changeParams function because it can't find "Type", "Num1", etc.
Part of My flash code:
//These 3 variables need to be populated via Flex BEFORE the animation starts... var Num2:int; var Num1:int;