ActionScript 3.0 :: Retrieve Value Outside The Function?
Oct 22, 2009for example:
var retrieveMe:String;
box_mc.addEventListener(MouseEvent.CLICK, boxClick);
function boxClick(event:MouseEvent):void
[code].....
for example:
var retrieveMe:String;
box_mc.addEventListener(MouseEvent.CLICK, boxClick);
function boxClick(event:MouseEvent):void
[code].....
ActionScript Code:
package com
{
[code]....
i want the value of "newAngle" to be accessible outside of this function.
I am doing something dumb i'm sure....
Code:
function aim(e:MouseEvent):void
{
adj = mouseX - gun_mc.x;
opp = mouseY - gun_mc.y;
[Code].....
I would like to retrieve a value from a function(e.MouseEvent)?
[Code]...
When not, which solutions does replace this attempt?
I load image - and need its width and height in global variables, i dont know the image width and high that will be loaded; does enyone can explain me why it get NaN NaN or 0 0 or how can I retrieve this information outside from function loadComplete()?
[Code]....
My previous several posts had to do with this, but now it's driving me nuts. I'm trying to use the same imgArray data in the xmlLoaded function in the initThumbs function.[code]...
View 1 RepliesI am posting a thread regarding passing a javascript returned value into Flash. It is slightly complex due to the solution I am looking for must target Flash Player 6.
I have looked at various solutions including the Flash / JavaScript Integration Kit wrote by the guys at the former Macromedia. Unfortunately the solution involved includes various classes and then import them in Flash which produces the following error:
The class or interface 'com.macromedia.javascript.JavaScriptProxy' could not be loaded.
The Javascript I want to retrieve the value from looks like:
<script language="JavaScript">
<![CDATA[
function CheckIn(){
[Code].....
I just need to pass the returned value into a variable within Flash.
i'm loading in multiple images using the same loader using a for loop. what i'm trying to figure out is how can i tell when the first 4 images are loaded. is there away to attach and index to each loader and then get it from the event in the on complete function? below is the code i'm using:
[Code]...
I have this XML data that is coming in and am unable to find out why it will not match a image name with the requested name. It seems to when traced to be showing [object Loader]. I tried converting it to a string, but it will not accept the attribute as a string[code]...
View 5 RepliesI have seen more than a couple of sites using flash content and displaying it based on the URL string.
For example, accessing http://domain.com/ loads the site normally and the SWF object displays the home page and sets the URL to http://domain.com/#/home. Then accessing the About section sets the URL to http://domain.com/#/about
Also, if accessing http://domain.com/#/services directly (from the browser's address bar), loads the site and the SWF displays the Services section automatically.
I have an AxShockwaveFlash object in a Windows Forms application, and load a (AS3) movie into it with LoadMovie. The movie plays correctly, but I am having a problem getting a variable from flash.I have tried using GetVariable but it always returns an empty string. How can I get the value of a variable from flash?
View 2 Repliesan easy answer for 99% of you. I have a custom class 'Users()'. In PHP I have all the values being populated correctly. When I go to Flash Builder - and do the test function - All the data comes back properly. However, when I click a button and refer to the lastResult property of the CallResponder - it comes up NULL the first time, and then if the button is clicked a second time it will return the correct result. What step am I missing? I had the same problem with something simliar last night and am getting BEYOND frustrated - especially since I know it is some SMALL detail I'm overlooking.So just for clarification - lets say there is a button named button1So button1's click handler:1) Validates the text input properties2) Asks the server if that user and password match3) If they do - then I want it to grab all of that specific users info and put it into a User class. Again - when I test this function/method from within Flash Builder all the values come back as they should. It's just on the first button click they come back NULL...he second click they populate fine - I.E.-
Alert.show(currentUser.userFirstName); (First Click - NULL)
Alert.show(currentUser.userFirstName); (Second click - "Jack")
How can I retrieve all MC in a Stage?
I want to call addEventListener for all MovieClip present in my stage and if it's possible in a selected frame number of my scenario[code]...
well after I made all of the conditional statements I came to the conclussion and the annoyance that I cannot retrieve the statements value, I need help:[code]it does not return the value.. why?
View 5 RepliesI have a MovieClip and need to get the drawing information from the graphics property. Is there any way to retrieve an IGraphicsData vector from the graphics property? In fact is there any way at all of retrieving the drawing information?
View 2 Repliesbasically i have a custom function for the array class. and within it i can refer to the aarray by using "this" however in a trace statement i want to be able to get the name of the array.
Code:
// i think getDefinitionByName() might be of some kind of help.
var myArray:Array = [1,2,3,4,5]
Array.prototype.functionName = function(){
[code]....
Is it possible to retrieve the name of an XML node and his successors?
I wanna do a news program in flash that interface with an XML file.. The flash program have to inserted text and images retrieved from XML[code]...
1. Create a XML/PHP driven menu that uses PHP to generate a XML file with database results.
2. Use flash to retrieve the XML and dynamically add movie clip, menu buttons that have label values, IDs, and whether or not the menu item is published from XML, to the menu.
I found some code from a tutorial that took XML data and added a movie clip to the stage, added a label, and an ID; however, I could not get it to get a URL property to the button and initiate the navigateToURL to actually get the unique variable to come from the XML to each instance of the button. I have attached the ZIP file with the original tutorial AS file.
I've got a Vector of ViewToActionMap objects, which have following constructor:
public function ViewToActionMap(_forModule:eModule,
_forAction:eViewAction,
_toFunction:Function,
[code].....
I am getting a very strange error:
error I get when trying to execute static function createDeadShip in Deadship:
Quote:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at global$init()//references to the line public class DeadPlayerShip extends DeadShip
[Code].....
This is truly the strangest error i've ever seen.
I am trying to access data from an array. The array is in the root and I am trying to get it's data into a submovie. In as2 it would have been:
mylabel.text = _root.myarray[1];
So, i have tried:
mylabel.text = root.myarray[1];
and
mylabel.text = (this.root as Array).myarray[1];
and tons of other configurations.. I get the 1119 error no matter what i do. I am beginning to think I just can't get the info from the array in a sub movie..
I am using the setStyle to set the text label on some buttons in flash. AS3.Set font to bold and color to red. myButton.setStyle ("textFormat", redBoldFormat);I do this on as part of a function when the button is clicked.Is there a way to retreive the textformat settings (like bold, etc) so I can un-set the format? I have 5 buttons, when one is clicked, it goes bold and red.When a different button is clicked, I would like the previously clicked button to go back to "not bold" and "not red" and so on,
View 1 RepliesI will try to state this simply. If required I can post my code. I have created a class that extends the MovieClip. It is basically a retangular shape, with a color and a label that can be set via the "properties" concept. The label.text property is public.
I create a "new" object of this item (more or less a button) depending on reading an xml file.
If the file has 3 names (titles like "Lesson 1", Lesson 2" etc). I create a new "button" for each name in the xml file.
so I can get 3 instances of the object on the stage. Which I get. I create each new object like this:
var link:linkBase;
var menu:linkBase;
I use a for loop to read the xml data, and create the instances:
for ....
menu = new linkBase();
// i try to give it an instance name like the
menu.name = xmlList[i].name // name = "Week1", "Week2", "Week3", etc
i push the menu object into an array like this: nav_button.push(menu), in the for loop.
I can draw the three objects on the stage. I have a stage listener that will trace the target name if I click on the instance. I get "null" if I click off the button. My problem is that I get the target name for only the second and third instances, and not the first. If I comment out the menu.name line, and click each instance on the stage, I get "instance9", instance12, instance15. So I know there are three objects there.
I can do something like this to get a name on the first instance: nav_button[0].name = xmlList.week, or hard code a string like "Week1".
But I want to be able to do this in a loop of some sort. I am trying to create a user friendly name for each instance, so I know what I am clicking on, and take action depending on the name "week1", "week2" etc.
what I am missing in terms of naming a instance on the stage?
Inside my loop, where i get my XML objects I added a code to draw and add the mask:
var myMask:MovieClip = new MovieClip();
// settings for width height x y color fill etc etc.
myMask.name = "NAME-"+i; // set the NAME
myContainer.addChild(myMask);
myContainer.mask = myMask;
the mask looks fine on the stage.now since i name it, i want to use it for other purpose like moving it now i want to actual call myMask
i get my number "num" from other function, that works fine
function applyMask(num:int):void {
// need to call myMask("NAME-"+num)
}
i have tried myContainer.getChildByNamehave tried:
var masking:myContainer=getChildByName("NAME-"+String(num)) as myContainer;
i have traced for options i can think of myself, but all result no property found.
How do we retrieve data in a webpage for comparasion? I need to do this because I dont have complete control or curtain aspects and need to change menu tilte data ( French or English ) depending on what the Webpage Title data is displayed. I have serverside code in the title eg.{title} that will start with either "Welcome" or "Bienvenue".
So I need to retrieve the first word or amount of characters compair.
if var webpdata =="Welcome" then var menuitemdata=english
else var menuitemdata=french
The above is just a idea and not actuall script of course
I'm doing an order form, where the user can input his contact information and then choose a product in a dropdown menu.Untill now, I just gave the dynamic text fields a variable and used this code:
on (release) {
form.loadVariables(order.php, POST);
}
[code]......
I'm trying to retrieve values from AS2 to AS3. Here's my codeAS2
code:var as2Txt;as2Txt.text = "My text!"loadMovie("as3.swf", mc_holder);AS3 code:var as3Txt;as3Txt.text = _root.as2Txt;//
I have this simple xml i but when i run it i dont see anything traced even though there is no error message:
var myXML:XML;
var nodeId:Number;
nodeId = 25;
var myLoader:URLLoader = new URLLoader();
[Code]....
I am trying to place a condition statement so that it will only do an action if the swf loaded into the varaible is the same or empty. I start of with loading the sample1.swf into the movieclip swf_holder
Code:
var loadSwf:Loader = new Loader();
swf_holder.addChild(loadSwf);
loadSwf.load(new URLRequest(sample1.swf));
loadSwf.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
In order for me to get the sample1.swf to play, I create a variable so that I can just call on it
[Code]....
here's the thing, i need to store different values in a 2d array (or something conceptually similar). The idea is to create a 2d map with tiles and the array would save the ID of every tile in the map. I'm trying to create something mildly efficient, specially because i need to save some memory usage for later use (it has to do with AI) and it must run on a low end PC, but simply creating an array seems to be a waste of space since i only have about 50 different IDs at any given map.i thought about creating a 2d array of 8bit chars would be sufficient, but that's out of the question with actionscript 3, it doesn't have 8bit char data type.
View 1 Replies