ActionScript 2.0 :: Can Assign Vars To An Object On Fly
Sep 23, 2003if i have an input box on the stage, can i assign it a variable via an event (let's say a button click)?[code]
View 1 Repliesif i have an input box on the stage, can i assign it a variable via an event (let's say a button click)?[code]
View 1 Repliesis it correct to assign multiple Boolean vars like so:
public var var1, Var2, Var3, Var4:Boolean = false;
i am trying to load vars from a text file into a load vars object.
var kitchentext = new LoadVars();
kitchentext.load('moccastext.txt');
Once in the object, i thought i could reference them like so
kitchentext.name
kitchentext.style
but i am having trouble doing this.
i have a textbox called displytext.
_root.displaytext.text = kitchentext.name;
doesnt work
I've made a Horizontal Bar Class which controls an element in library.So I have:Library: HorizontalBar MC - Using class HorizontalBarThis class has some public vars.Library: ContainerGame MC - Using class ContainerGameWhen I add this element to stage (HorizontalBar) inside ContainerGame MC I want to be able to trace public vars from its class inside ContainerGame.
View 2 RepliesIs it possible to automatically assign an object to a class during testing project? I know you can do so by assigning in a movie clip's property the identifier but I need to know if I'm say creating a game, and it gives the user the ability to choose a player, I need that player/movie clip that the user chose to be assigned to a specific actionscript class.
View 4 RepliesIn my current actionscript project I have two objects that I draw at runtime in the drawing API, and I want to assign one of them as the other's mask.
View 2 RepliesI have an object on stage that when I want to click it start to move cross the stage. But I get error:"Scene 1, Layer 'Layer 1', Frame 1, Line 41136: Incorrect number of arguments. Expected 1."
function animate(evt:MouseEvent)
{
animate1();
[code]......
How do you assign an object different variables.I tried setting it up like this but I get an error.[code]How do you do this correctly I get error Label must be simple identifier when I do it like this.
View 2 Repliestrying to find how to assign listener to an object created with this function...
Code:
private function placeBtn(thumb:String, Xthumb:Number, Ythumb:Number, targetHolder:MovieClip, ID:String):void{
var clipHolder:MovieClip = new MovieClip();
[Code]....
i want to assign a transform matrix to an object, but i want to assign the values myself (as in, no 'rotate, scale etc'), but for example, set a matrix like
[Code]...
which if applied, would have no effect, but would be valid (actually not exactly that matrix, but you get the idea). i want to set the values of the matrix and the object should be affected by those values that i set by myself, no scale rotate or any predefined operations. how can i set my own matrix?
Here i have creating a dynamic square and trying to assing a color from XML DataI have XML file with color code
<data>
<colour>
0x0000FF
[code].....
How you can assign a class to an object on stage.[code]...
This would make a new object, but the current object already exists, it just needs to be notified that it's of the type "ClassName" so it can inherit it's properties.I've also tried assigning the "ClassName" in the linkage as either the base path or the class name. But in either situations I get an error saying that the class needs to be unique when I use the same class on multiple objects.
This is a work around question:
lets say I have the following:
onstage:
this.someobject
this.someobject.x
this.someobject.y
is there a way to assign the x or y property
var xORybject;
so that the following is evaluated correctly
this.someobject[this.xORy] == this.someobject.x || this.someobject.y
I have created an object called myObj.
How do I create a class that I can call that will assign properties to myObj such that PHP Code:
myObj = {foo:15, bar:"hello"}
...?
BTW, I do not want to just say
PHP Code:
var myObj:Object = {foo:15, bar:"hello"}
...because in fact I am going to be creating a bunch of objects all having the same properties, and there will be many more such objects.
I am really confused with this tutorial as there is shown how to assign z dimension to the Sprite object. It is never declared, so I assume the z property should be implemented to the Sprite class. But obviously I get an error when I try to build the application does not matter if it is flash or flex app. From my point of knowledge I can not find z property for Sprite in the actionscript, so I do not know how Lee implemented his code to work. Below I put all the code from the tutorial, so you can quickly glimpse at it. How is it possible to assign z dimension to work it, or suggest what kind of class to import or whatever I should do, or know anything about the z dimension in flash player 10.I do not really think z could be in 10-beta and is not in 10 official.
Code:
Select allpackage {
import com.caurina.transitions.*;
import flash.display.Sprite;
import flash.events.*;
[SWF(width="600", height="400", backgroundColor="#FFFFFF", framerate="30")]
public class ThreeD extends Sprite{
[Code] .....
I am trying to use JSON decoded as a dataProvider, but no matter what I try I get errors such as the following: Error #1034: Type Coercion failed: cannot convert mx.collections::ArrayCollection@2a88ae01 to fl.data.DataProvider.
[Code]...
I'll try to make this as clear as possible. Let's say i have 4 "classes".
[Code]...
Let's say now i use a loop to create 8 obj. I'd like to assign a class to each obj in function of an array like : array = [class1, class2, class1, class3, class2, class4... ] so obj0 class' should be array[0]
I'm trying to learn shared objects by attempting a basic function. I would like to have an .sol file remeber what buttons are clicked on by a user and assign an alphavalue for the buttons that have been clicked. Here's what I have..
[Code]...
I have written a framework that facilitates RPC calls between AS3 and PHP 5 called FlashMOG. I recently got a forum request that has introduced a pretty bizarre question regarding access control. This will be a lot easier to discuss if you have access to the FlashMOG 0.3.1 client source which is here:
[code]...
The basic idea is that I have a FlashMOGService class which has an RPCSocket member that it may share with other FlashMOGService objects. The idea is that you can create two distinct FlashMOGService objects and have them both connect to the same host/port via socket. I use my special RPCSocket class for two reasons:
1) Let developers use one port but separate functionality into two distinct services...a form of multiplexing i guess
2) RPCSocket adds functionality to the standard Socket class that works to serialize and unserialize data and get it where it needs to go. The essence of the problem here is that created a class with a FlashMOGService object as a member and has tried to assign a private method of his class as an event handler to the FlashMOGService object:
[Code]....
My initial thought is that this should be fine because it's all done within the class. However, when I consider the monkey chain that results in this function being called, it seems almost logical that it wouldn't work. The problem is that the browser freezes when a socket message arrives that tries to call the service's client method, _service.client.firstClientMethod. This client firstClientMethod is attempted when data arrives from the server on the Socket (an RPCSocket, actually). The RPCSocket class deserializes the socket data and extracts an array with a service name, a method name, and an array of arguments. It looks into its own private class variable (an array of services using the RPCSocket) and tries to invoke whatever function was assigned thusly:
[Code]....
I'm guessing there's some kind of infinite loop going on to check access control for the various intertwined classes.
I'm building a little application in AS3 but I need to get variables from PHP. I searched on the internet on how I should do that. It makes the connection, but it doesn't get the variables. It just prints whole my php script.
[Code]...
I think this should not be a big deal, but I do not get it to work. I got a "MainFlash" witch loades an XML with about 60 variables (Settings), in base of a paramater then this "MainFlash" loades another "FlashMovie" and this one needs, all, the same Variables too.
How do I properly pass all the Vars in the new/other "FlashMovie"?
U need to know I use LoadMovieNum to Level 0 I do replace the "MainFlash", cause the new loaded "FlashMovie" can have a completly different height and width ( ...I don't think it's possible to change the Document-Setting in a compiled swf, or is it? If this is possible I would not need to load a separate swf to Level 0. the main SWF usually ist about 320x180, the following can be 2x, 3x bigger...
var navChildXml:XML = <subpoint>
<text>XML(_nodes[prop].childNodes[inc].title)</text>
<link>XML(_nodes[prop].childNodes[inc].title)</link>
</subpoint>;
how to in this instance
the vars are not being declared
I've created a Flash interface that sends variables to PHP to place in MySQL.In Flash I have the following AS2 (abbreviated) ..
myVars=new LoadVars();
submit_btn.onRelease=function() {
myVars.username=_root.username;[code]..........
Invariably the else statement is deployed and a new record is inserted into the database even when the username and passwords (md5 encrypted) are identical. I've been on PHP forums and nobody has a solution, so I'm wondering if this is a Flash issue. Perhaps even though the username and password in MySQL 'appear' identical to what's submitted by Flash and md5 encrypted they're really not for some reason. I tried trim() and stripslashes() to no avail.
I have set something up for my flashvars. I have a form in html which accepts two inputs. This is then sent to this php page
[Code]...
how can I do this trick and keep different vars for each mc?
for(var i=0; i<arr.length; i++) {
var mc[i] = _root.createEmptyMovieClip('mc'+i, _root.getNextHighestDepth());}
i have two swf files, a preloader witch loads main.swf
in preloader on the maintimeline i set this var
var lang:String = "de";
but i cant trace it in my main.swf
trace(root.lang);
how do i get this var?
this should be simple as nothing but i just need to get a clearer picture here my PHP has this as final line
[Code]...
where $newPics is a number what do I insert in AS code to to retrieve that variable and store it as an AS variable?
I've surfed for days to find a solution to this. There are a jillion out there, but I haven't found one that works. Suppose I have the following
<?php
header('location:http://www.sleepydad.com?firstName=s...ame=dad');
// the above URL will house my Flash movie
?>
I need to get the values of firstName and lastName into my Flash movie to save as variables (ultimately LoadVars()) and pass as an ID for some MySQL tasks performed in my Flash movie. NOTE the value of the names are not constant (ie sleepy dad). They will change with login - each user having a unique name. I've tried modifying the javascript in my HTML - some.swf?firstName=firstName (in both Object & Embed Tags)
[Code]....
I am working on a project that uses PHP , as3, and possibly some AMFPHP.
The project allows users to upload and download images among other things. I have been trying to gather as much info about making things as secure as possible. I've got some good advise about using .htaccess files, and a few other tricks.
My main question at the moment is how to hide the "path" info from and to the PHP / assets / and to and from the AMFPHP sevices ...
Currently I have all the paths hard-coded in one .as that returns an object with the paths to any of the other classes that need/request it. I found this method to work well since I only need to change this one .AS , and it will branch out to the other classes that need it.
I'm not super worried about others decompiling my code, and they could probably "sniff" out the paths if they really wanted. I'm mostly concerned with allowing others easy access to all of my AMFPHP services or being allowed to parts of the site I do not wish them to be. basically I realize that things aren't gonna be 100% secure regardless, but would like to take precautions.
So to cut to the chase ... Whats the best- simplest way to obscure / hide the paths being used in a PHP - AS3 project ? ... I entertained the possibly of PHP includes or even a SQL database if need be. I rather not spend a bunch of time and money on questionable obfuscator software, unless there's a tried and true one for flash (not flex). .. and I currently do not have a SSL but don't know how critical - common this is.
When I run the flash from my local host (using XAMPP) it all works fine. But when I put the whole thing onto my online web server and change the URL to access the php file, its just coming back as "NaN" ...so why does it work on my local server but not the online one?
View 6 Replies