ActionScript 2.0 :: When You Need More Values Inside Each Element, It Gets Difficult To Maintain?
Mar 18, 2010
Is there another way to write this array in AS2?:
Code:
var img_array:Array = new Array({img:"nav_thumb1", img:"thumb_01"}, {img:"nav_thumb2", img:"thumb_02"}, {img:"nav_thumb3", img:"thumb_03"});
This is pretty simple, but when you need more values inside each element, it gets difficult to maintain.I know I could probably do this using XML, but I'm trying to learn all about arrays
I know that there is no such function as getElementByName in Flex but I also now that you can do this["object_id"] to get the element of the application u're in.What about getting an element inside another element?I've tried making element["id"] ? But in my try-catch it always runs the "catch" part..how do I get an element inside another element just having it's id in dynamically created string form?
I have a dataGrid with a dataProvider "documents"A column of the datagrid has a labelFunction that gets the project_id field of the document, and returns the project name, from a bindable variable "projects"Now, I dispatch the events to download from the server the documents and the projects, but If the documents get downloaded before the projects, then the label function gives an error (no "projects" variable)Therefore, I must serialize the commands being executed: the getDocuments command must execute only after the getProjects command.In the real world, though, I have dozens of resources being downloaded, and those command are not always grouped together (so I can't for example execute the second command from the onSuccess() method of the first, because not always they must be executed together..)..
I've used jqUploader for a while but I find that it will occasionally fail to work on certain browsers on certain machines or will not work properly when using HTTP Basic authentication. I've tired of trying to get this to work properly and am considering switching to another (hopefully) less buggy uploader. I've looked into Uploadify and it so far seems promising. Have you experience with any alternatives to jqUploader including possibly Uploadify? If so, what are your thoughts and recommendations?I would prefer that configuring any such uploader require knowledge of JavaScript and/or jQuery, and that it not be totally reliant on any one specific back-end technology. Built-in PHP compatibility is a plus.
Using the following code:[code]Triggering play() and stop() works as expected, however the href doesn't do much, as the click event is sent to the flashplayer, and not following the hyperlink.I have several such flashplayers on the page, and I'm trying to find a way to 'activate' the href onClick and honor the url specified in the <a href=""> construct. Specifically, it's in IE8 I'm struggling.How can I do this using html/javascript?After having come across javascript onclick event over flash object I managed to get closer to what I'm after. Using the onmousedown event, I can trigger javascript when clicking my overlay div. What's a good generic way to read the parent href url and issue location.href='/myparenturl';" style="cursor: pointer; ?
I'm having a bit of problems with simple XML coding. I'm using a simple flash application to write a XML containing customer data (simple stuff, like phone number, name, email, etc).I understand how to write XML manually, but my issue comes when I want to create a element inside another element. I'm using AS3.So, for example, I have the following xml.
Isn't there a way to loop over each image in the hgroup and add the eventhandler? Something like this:
[code]...
My teacher told me this isn't possible but in case of 10+ images, I can't imagine doing it for every image separately. There has to be a better way to do this, no?
I'm trying to check if a clicked element is inside of an IVisualElement in Flex 4. So I want something like "if this element is in this element, then execute function". I'm aware of the 'parent' property but this doesn't seem to work when my element is not a direct child of the element but for example 3 levels deep.
I need to get the position (x,y) of the last char in a textField with html text inside. I try with numlines and getLineMetrics, but that only work for non-html text. If I have a text like
Code: <p>text one</p><p>This is the other text</p><br><br>
I need to have the position on the stage of the last "t".
I have two swf file, A.swf and B.swf, each with its Document Class: B.swf is loaded in a MovieClip of A.swf. When loaded, B.swf creates an instance of CSDragger (it is a library object with its class extending MovieClip) and sets an ID property of this instance to a certain value. When this dragger is dropped by the user upon a MovieClip it sends a custom event containing the value of ID too. The custom event regularly reaches B.swf but never reaches A.swf. Aside from refactoring the CSDragger class (eg moving its handleDrop method in the B.swf document class), is there any way for the event to reach A.swf? I know I can intercept it and dispatch another event, but I was looking for a different solution (if any).[code]
The answer to my question is possibly easy, yet I haven't found an example of solving it in the web, nor have I found a solution reading ActionScript reference. My problem is the following: I have a big UIComponent derivate element inside a Scroller (spark.components.Scroller) window. The Scroller class is great because when my canvas element, that changes size dynamically, exceeds its boundaries, scrollbars appear automatically and handle scrolling of my UIComponent inside it. However, I'd like not just to be able to Scroll using these automatically appeared scroll bars, but also by using a pan tool that I will myself implement (similar to the hand tool in Adobe software, for example). The thing is that I am not able to modify correctly the element's position inside the Scroller window.
I tried, as a first approach, accessing to my elements' 'x' and 'y' properties, however, when changing them, I dont get the resulkts wanted. The code for it is the following (in which, for symplifying reasons, I used a text label as my 'inside' element, and two buttons as an external scroll controller, instead of a hand tool)
I have two InputText boxes (Flash CS5 AS3). I will perform calculations with the values that are placed inside the boxes. How can I turn their values into numbers? I will eventually restrict the boxes to numeric values only.
I need an application to test the accelerometer values on my mobile phone. I need the values on my system so that I can manipulate that info for something else.
If I write an Android application, the values will be inside the Mobile phone, which is not what I want.
I have written an app in Flash, n tested in Adobe Device Central. Only catch is that instead of simulator, I need to test it on my mobile. How do i do this?
I have a simple FOR loop which runs through an array of MC names, which runs fine, but I'm trying to use these names inside this array as hittest values. So, I have one MC, and the code in this MC runs through an array and checks for any collisions between it and the mc in the array.
My intention is to have an array with several variables, each one with a different name, all of them of the type 'Number'. This I can do.What I can't do is to access the variables using the array's index.
Paste this on your frame 1:
Code: trace("======at frame 1======"); //objects// var objects:Array = new Array();
[code]....
As you can see, the code is changing the value of the array element and not the value of the variable inside the array element.
Say i have a UI with check boxes, text fields etc on 1 frame, and again a different layout on another. If i type values into boxes and click radio and check boxes. is there a way to keep these values on there when i flick to another frame then back again?
I want to know if I have variables inside amovie clip that get some values after user contact and I want to use this values in other frames in the main timeline.
I am trying to create a dialogue system for a game that references lines of dialogue to be displayed from an array.Example:
var myArray:Array = new Array("My name is David.","I am a noob at actionscript.");
This all works fine, but what I really want to do is have the name "David" be a variable so that the user can change. The issue is that the array seems to convert any string variables into their string value so when they are referenced they only appear as the initial value of the variable.
Example: var myName:String = "Empty"; var myArray:Array = new Array("My name is "+myName+".","I am a noob at actionscript."); //user does something to change the variable myName
[code]....
Output: My name is Empty.,I am a noob at actionscript.When what I want is for it to say: My name is Jones.
How to change a link inside the flash element? I have SWF file with set a link inside and I want to change to mine on the website. This thing I need to control the advertisment system.Trying this, but not working:
<style> #content { position: absolute; z-index:2;
[code]....
But you need everytime to put top, left, margin-bottom parameters. Can someone modify it to make working correct without pointing top, left, margin-bottom parameters?
I'm trying to make a login function that receives the username and password as arguments, does all the proper URLRequest and URLLoader stuff inside it, and retrieves some values from the database. Then, it puts those values inside an object (a little associative array really) and returns them. I've put 'trace' sentences all over the function, and it seems to be working without a problem and is retrieving the right values from the database. However, when I try to assign the returned value with something like:
I have flash where there is a link for song download. And, at the bottom of the flash I've a count, loaded thorugh flash vars which should increment everytime donload button is hit. Please let me know what approach should i take to do that. can i call a Java method on donload button which will insert a row in the table and and then get the count and render it to the count variable in my flash?
May be this extremely confusing. Here is a very similar example on how it is done. This is actually very similar to what i want to do. [URL] on this link there is count below which increments you hit the download button.
I've built a rather robust tooltip class recently that attaches and draws a single tooltip sprite to the root, then uses MOUSE_OVER to detect when it is over a tooltippable object, and shows the appropriate tooltip text. At the moment, I'm ensuring that any elements in my application which wants to take advantage of showing tooltips implement the ITooltippable interface, and expose a public getter, get tooltip().
Basically I have 14 text boxes, each box draws its content from an external txt file. Next to each text box is a button. I want the button to be either visible=true or visible=false depending on weather or not the text box has content or is "undefined" Here is what I have so far, and it's not working:[code] I would like a FOR loop to just run through the variables and check to see if any of them are undefined. if it is, then make the correct send button invisible.