Flex :: 3 - Flash - Change Sate In Code Using A Variable?
Jul 28, 2010How do I change the application state in code, using a variable? when I provide a static string it works fine, but not with a variable.
[Code]...
How do I change the application state in code, using a variable? when I provide a static string it works fine, but not with a variable.
[Code]...
I'm developping an application for my thesis.Now I have an application-context.properties.txt where I define:
host= (ip address)
port=8080
Now this is static and I change the ip address to the server I want to connect to.But this isn't verry usefull for the user because he can't access that file.Now is my question can I change this host ip address from in my flex code?
Here is code for drag. i want to change as3 class to normal code as3
View 6 RepliesI am encountering a bizarre Flex 3.4 issue. I have a class that acts a dataprovider to my entire application named "DataProvider.as":
package {
public class DataProvider {
[Bindable]
public static var email_enable:Boolean = true;
}}
In an mxml form, "Settings.mxml" I have a checkbox control which is bound to the email_enable variable of my dataprovider class:
<mx:CheckBox x="452" y="170" label="{Language.loadLanguageResource('lblEmail')}"
id="chkEmail"
selected="{DataProvider.email_enable}"
change="onChange()"/>
All is well as far as getting the value, if I set the variable in my dataprovider to either true or false, the checkbox reflects this change; however, if I click on the checkbox and change it's value, the dataprovider variable never reflects the change.
I'm working on an app for iOS where I want to load content dynamically from the library that contains text and graphics inside different MovieClip's.However, I have a problem, the code I have is for bitmap!How can I change it so it works for MovieClip instead?I want to use the MovieClip instead of bitmap?Also want to use the MovieClip class instead of Sprite class?[code]
View 5 RepliesIs it possible to change the stage's background through actionscript?
View 4 RepliesI'm trying to pass the contents of variable playnoyes to the long line of code below to decide whether or not to autoplay the flash movie, but doing it as I have below, the resultant line of code has the variable in quotes and therefore the code doesn't execute it as expected. My question is, how can I pass the variable so that the resulting line of code doesn't have the quotes around the variable value.
var playnoyes='true';
var testtext = "<script type='text/javascript'>AC_FL_RunContent ('codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.[code]....
ActionScript 3 - CS5'm new to Flash and wondering how to change fill color from code. Something like this - btnRed.fillColor = "0xff0000"
View 1 RepliesIs it possible to add code (...html or php?) to an html link (i.e the link will be featured in an html website) that passes a variable into the flash site it links to (just something simple like '_root.pageChoice = "home3" '? So when the site opens the swf turns to a certain page?This will be necessary as there will be links to the site from different html sites and each will need to see a different version of a certain page.
View 4 RepliesI was wondering how you can make variable code within code, for example, normally, you can use this["blabla"+variable]; to make the code say blablavariable. But now i want to make new variables by using this code, within a for loop [using teller1 as the increasing value] this["var ringsegment_mc:Ring_"+teller1+"=new [Ring_"+teller1+"]()"]; which i basically want to have say:var ringsegment_mc:Ring_1=new Ring_1();
but this doesnt work, it doesnt make a variable called ringsegment_mc. why I want to do this, is because i need to make an add child which makes 16 parts, from 16 different movieclips.
[Code]...
I am looking to add some code to my xml file that will change the final font, size and colour in Flash Action Script 2. I want to be able to have the choice of a few font sizes, styles and colours. Below is the AS2 script so far, and the XML.
stop();
var myGalleryXML = new XML();
myGalleryXML.ignoreWhite = true;[code].......
I am running an swf preview.swf, How can i change the value of flash variable mode using jquery ??
I have code something like
AC_FL_RunContent(
"src", "preview",
"width", "378",
[Code].....
Im really new to as3, and im just trying out some stuff, but i cant get a shape to refresh and change when i change its variable using a text field.If i change the text fields text before i test it, it works, but while its running it doesnt change it again.Btw, trying to change the stroke size.[code]i just want is so that when i change the strokeSize_txt text box, it will change the stroke for the shape.
View 2 RepliesI want to change a variable set to 0 in the parent to 1 when a button in the child is clicked.
This is the parent zero.swf:
var noPass:Number=0;
function getPass(event:onLoad, noPass):void {
if(noPass==0) {
[Code]....
I have been banging my head against a brick wall regarding the following problem which must be very simple to fix, just can't see the answer.I have a class assigned to a movieclip called canvas. The class is called drawClass. I have called the instance of canvas on the stage 'drawingCanvas'.When I trace "drawingCanvas" I get object drawClass] which is fine. Tracing drawingCanvas.name gets me the instance name 'drawingCanvas'.This is a String variable.Basically what I am trying to do is pass the MovieClip name to another class. In my example the class 'toolBar', which can then interact with the MovieClip.
The problem is passing 'drawingCanvas.name' results in a String, so I get an error saying :TypeError: Error #1034: Type Coercion failed: cannot convert "canvasArea" to flash.display.MovieClip.I can't for love or money find a way to convert a String variable to a MovieClip variable! I have the name of the MovieClip, I just need to tell the toolbar class. But I can't find a way of doing this as the instance on stage is an object of drawingClass, not a MovieClip (unless MovieClips with attached classes are not treated as standard MovieClips?).
I'm trying to achieve something i thought would be extremely easy, but i can't get it to work!
[Code]...
I am building a project where I got XML text displayed on a textfield. How can I change a specific word's color through actionscript 3 instead of doing it on XML? I though of creating a String variable for my word and then using that variable in my textfield.text, it works but is it possible to set a color for that variable?
View 3 RepliesI am fairly new to Flash. I have a stage up with a simple button; the Instance Name is init. My .as script (MainTimeline) is accessed externally from the stage:
[Code]...
I'm creating a board game which has 3 variables, p1Move, p2Move and activePlayer.
p1Move and p2Move store the p1 and p2 location on a game board. activePlayer stored who's turn it is at the moment.
I am loading a value in from a text file which changes the value of move. This all works fine when i designate a player directly:
ActionScript Code:
p1Move = [insert variable name],
but i want to designate dynamically based on who's turn it is.
Something like this:
ActionScript Code:
_root["p"+activePlayer+"Move"] = Number(this.varAmount);
so that flash changes the value of p1Move (or p2Move depending on who's turn it is) to varAmount. varAmount is the variable being read from the textfile.
Hopefully that all makes sense. Basically i want flash to change the variable associated with the active player only.
I've created a simple Flex application to fetch an XML file. I need a Flex variable "id" to grab the "letters" value from the tag in the XML code, then show the id in an Alert window. When I run this code now (with the full code), the Alert box is blank.When I run the application in Flex Debug mode, this is what Flex sees: http:[url]....Below is the Flex and XML code (edited to only show what's not working):
// Flex
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication ...[code].....
Im trying to make it so instead of the actionscript doing all the work for the button "btn". I want it so the button has all the AS in it instead. So instead of this code in the animation...
Code:
btn.onEnterFrame = function() {
if (rewind == true) {
prevFrame();[code]...
I have this line of [code]...
MOBNAME is the variable that contains the name of the monster that attacked me, and I need to know what I need to put to use the value and not the name of the variable.[code]...
What would be the best way to implement the konami code into a flex application?
I want to create a component to add it on all my proyects, just for fun.
[Code]...
I have 2 buttons on the stage that when pressed birth MC onto the stage,these mc are dragable and have a transform manager applyed to each mc when clicked on stage.
I have a color_btn that when clicked will change the colour from default black to white
the problem is finding which instance the button is to change the color value as there can be multiple instances on stage at any one time.[code]...
I have this code that I changed into a package. Now my elements in my array are giving me an access of undefined property.
View 1 RepliesI've followed a tutorial and everthing works fine but I'd like to use hit-tests instead of the intersect-code. change the code so it works just the same with hit-tests.I dont get the same result.
View 4 RepliesWell basically what I want to do is have my code figure out that a variable has changed value and then call a function to store that value in my class.I have a component with a text box in it that displays a value gotten from either typing in the box or moving a slider. I then need the last value (where they stop sliding or typing) to be stored in my class
View 4 RepliesI have this code creates a function at runtime (yes, this IS needed):
PHP Code:
var createdFunction = function():void {
trace("Function Created");
}
createdFunction();
Putting in in to the actions panel in Flash CS4 and compiling works fine, tracing the message "Function Created"...However, the Flex compiler gives me this
Quote:
Error: Call to a possibly undefined method createdFunction.
createdFunction();
Build halted with errors (fcsh).
Are there any examples on how to use the code found in the OSM framework in Flex? I would also need the player to be skinnable .
View 1 RepliesIt it posible to change the movie clip name with code.Something likemc1._name = 'mc2';
View 2 Replies