Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash








Declare Data Types Within An Object?


Hi all. I am creating an object like this:


Code:
var myObject:Object = new Object();
When I add new properties to the object, some will be numbers and others strings.

Is this syntax correct, or do I need to declare the data type for each property?


Code:
myObject.userName = "Joe Smith";
myObject.passed = "yes";
myObject.previousUser = "no";
myObject.programScore = 78;
myObject.screenName = "0301";
Didn't know if I should declare string, boolean and numeric data types within an object or not.

Thank you.

MaryAnne




ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 02-01-2007, 04:33 PM


View Complete Forum Thread with Replies

Sponsored Links:

Mx.data.components - Unable To Declare Data Component Types In External Class Files
Hi all,

FlashMX 2004, v7.2:

I am trying to declare instances of data-components (DataSet and DataHolder) in external classfiles, but Flash can't find the sourcefiles for any of the data component classes in the classpath.

According to the help-files, the classname for the DataHolder component is:

Code:
mx.data.components.DataHolder


Similarly, the classname for the ComboBox component is:
mx.controls.ComboBox

Code:
mx.data.components.DataHolder


In the following, the ComboBox gets declared, and the DataHolder generates a "Class can't be loaded" error:


Code:
class my_class extends MovieClip {

var my_cbox:mx.controls.ComboBox;
var my_data:mx.data.components.DataHolder;

function my_class() {
// constructor function
}

}


Sure, it fails because there is no "components" folder in the mx.data folder (at least on my system), and I have been unable to find any DataHolder.as file anywhere either, even though the documentation gives examples that reference the mx.data.components-folder for various data components. I even tried re-installing to make sure I had not accidentally deleted any classfiles, but still no luck.

Am I missing something really obvious here? Does anyone know how to successfully import, declare or otherwise make use of data-components in external class files? Any help greatly appreciated.

View Replies !    View Related
Declare Variable Data Types
From my understanding, there is no need to declare variables data type like String, Number, Array for it to function. For example:

var abc:String = "abcde";
var abc:Number = 1234;
var abc:Array = new Array();

We can write it in easier way and it is still working.

abc = "abcde";
abc = 1234;
abc = new Array();

So, what is the purpose and benefit to declare the variable specific data type?

View Replies !    View Related
Array, Object, List...? Data Types Help
I'm making a game and it requires me to maintain hundreds of lists of objects.

Elements are frequently removed from these lists, and the entire lists are frequently sorted and scanned.

My Question: What is the most efficient data type for my needs?

Arrays work, but in order to remove an item I must scan the entire array for the matching object and then splice the object out. Here's an example of the type of function I'm using to remove an object from the list. Keep in mind that all of my game elements are provided a unique id for use with such searches.

Code:

public function removeArrayElement(id:int){
var arraylength:int=myArray.length;
for(var i:int=(arraylength-1);i>=0;i--){
if(arraylength[i].id==id){
myArray =myArray.slice(0,i).concat(myArray.slice(i+1));
return;
}
}
}
This works but there's got to be a better way.


It seems that Objects would represent a more efficient way since I could access an element without a loop, but there is no way that I know of to remove an element or to return all of the contents of one at once.

I've seen some information in the AS3 Language Reference about ArrayCollections and iLists etc, but I really am not quite sure how to use them, and I'm not sure if they would suit my purposes.


My goals again.
Maintain Lists of Objects where I may:
1#Add a Class of arbitrary type;
2#Remove an Element efficiently by reference or ID(can not be index position)
3#Retrieve the whole list of contents as references.


I've plenty of other work to do on the game so there's no real hurry, but this is in the back of my mind as something that I want to streamline, and I haven't been able to find any good information on the subject.

If no better way is known to this forum then I'd at least appreciate some reassurance that the way I'm doing it is about as good as other people may have tried.

Thanks -Rory-

View Replies !    View Related
"In(Object){...}" Function? Data Types For Object Variables?
I can create an object and use dot syntax to create, or reference, variables inside of it.

But how can I specify the data types of these variables?

Also, is there some way I can enter the namespace of the object over a number of lines via {}s instead of using repetitive dot syntax?

Thanks in advance.

View Replies !    View Related
How To Declare A New Data Type?
I have a new Data type ( fxn ) declared in delphi, and i would like to convert the code to actionscript

Code:
type fxn=procedure(t:extended;x:array of extended;var f:array of extended);
.....
procedure fp(t:extended;x:array of extended;var f:array of extended);
begin
f[0]:=x[1];
f[1]:=-sin(x[0])*(g/ll);
end;
....

procedure r_kutta6(eps,t0:extended;x0:array of extended;fnx:fxn;
var t:extended;var x:array of extended);
begin
...
fnx(t0,x0,f); //means fp(t0,x0,f); - when applying the procedure.
...
end;

...
r_kutta6(0.0001,t0,xx0,fp,t,xx);
how can i declare in actionscript such a new data type, and after - to use as i do in delphi
thanks!

View Replies !    View Related
How To Declare A New Data Type?
I have a new Data type ( fxn ) declared in delphi, and i would like to convert the code to actionscript

Code:
type fxn=procedure(t:extended;x:array of extended;var f:array of extended);
.....
procedure fp(t:extended;x:array of extended;var f:array of extended);
begin
f[0]:=x[1];
f[1]:=-sin(x[0])*(g/ll);
end;
....

procedure r_kutta6(eps,t0:extended;x0:array of extended;fnx:fxn;
var t:extended;var x:array of extended);
begin
...
fnx(t0,x0,f); //means fp(t0,x0,f); - when applying the procedure.
...
end;

...
r_kutta6(0.0001,t0,xx0,fp,t,xx);
how can i declare in actionscript such a new data type, and after - to use as i do in delphi
thanks!

View Replies !    View Related
How Do I Declare Components' Data As Variables?
ive read the components tut. and actually just tried to use it but its a little to different than what im trying to do. Actually all i need to know is how to declare uicomponents' data as variables that way i can recieve them in my email via php.


example:
www.caltrustmortgage.com/hope.swf

i need to make the radio buttons' and combo box's data sent to my email. I know how to do it with input text but not components.

View Replies !    View Related
How Do I Declare Components' Data As Variables?
ive read the components tut. and actually just tried to use it but its a little to different than what im trying to do. Actually all i need to know is how to declare uicomponents' data as variables that way i can recieve them in my email via php.


example:
www.caltrustmortgage.com/hope.swf

i need to make the radio buttons' and combo box's data sent to my email. I know how to do it with input text but not components.

View Replies !    View Related
Declare Object From Database Or Stringvariable
Dear Scripters!

I have some trouble with the declaration of an object. Since my content-management system has shortage of database fields, I wan't to create some by adding a AS object in a database field (1 database field becomes x fields of the object). Main question: Is it possible to declare an object from a string in a database? Example:

var account:Object = {name:"Macromedia, Inc.",
address:"600 Townsend Street",
city:"San Francisco",
state:"California",
zip:"94103",
balance:"1000"};


All code that is red is stored in the database. The original idea was to read the code from the database and "paste" it in a new object:


ActionScript Code:
function ObjectTest_Result(result) {
    trace("ObjectTests fired");
    var Rs:Object = result;
   
    //trace(Rs.getItemAt(0).note);
   
    var test:String = Rs.getItemAt(0).note;
   
    trace(test);
   
    var account:Object = ["{" + test + "}"];
 
   
    for (i in account) {
      trace("account."+i+" = "+account[i]);
      
    }
    trace("object test = " + account.address);
}

The above code is the result handler from a flash remoting call. The object is declared, but with only one variable instead of 6 (name, adress, city... etc etc). Does anyone know how to declare an object in this matter?

Thnx in advance,

Steven

View Replies !    View Related
String To Object Or Dinamicly Declare A Var
ActionScript Code:
var prslide:slide1 = new slide1;


ok, say i din't want to have it always be slide1. how can i change it at runtime.
for instance make a loop that incremented the value of and did something like

ActionScript Code:
i++var prslide:("slide"+i.toString()) = new ("slide"+i.toString());


this used to be easy in as2

View Replies !    View Related
Declare Object Using String From Database
Dear Shockers!

I have some trouble with the declaration of an object. Since my content-management system has shortage of database fields, I wan't to create some by adding a AS object in a database field (1 database field becomes x fields of the object). Main question: Is it possible to declare an object from a string in a database? Example:


var account:Object = {name:"Macromedia, Inc.",
address:"600 Townsend Street",
city:"San Francisco",
state:"California",
zip:"94103",
balance:"1000"};

All code that is bold is stored in the database. The original idea was to read the code from the database and "paste" it in a new object:


ActionScript Code:
function ObjectTest_Result(result) {
    trace("ObjectTests fired");
    var Rs:Object = result;
   
    //trace(Rs.getItemAt(0).note);
   
    var test:String = Rs.getItemAt(0).note;
   
    trace(test);
   
    var account:Object = ["{" + test + "}"];
 
   
    for (i in account) {
      trace("account."+i+" = "+account[i]);
      
    }
    trace("object test = " + account.address);
}


The above code is the result handler from a flash remoting call. The object is declared, but with only one variable instead of 6 (name, adress, city... etc etc). Does anyone know how to declare an object in this matter?

Thnx in advance,

Steven

View Replies !    View Related
Declare Object From Database Or String Variable
Dear scripters!

I have some trouble with the declaration of an object. Since my content-management system has shortage of database fields, I wan't to create some by adding a AS object in a database field (1 database field becomes x fields of the object). Main question: Is it possible to declare an object from a string in a database? Example:


var account:Object = {name:"Macromedia, Inc.",
address:"600 Townsend Street",
city:"San Francisco",
state:"California",
zip:"94103",
balance:"1000"};


All code that is red is stored in the database. The original idea was to read the code from the database and "paste" it in a new object:


Code:
function ObjectTest_Result(result) {
trace("ObjectTests fired");
var Rs:Object = result;

//trace(Rs.getItemAt(0).note);

var test:String = Rs.getItemAt(0).note;

trace(test);

var account:Object = ["{" + test + "}"];


for (i in account) {
trace("account."+i+" = "+account[i]);

}
trace("object test = " + account.address);
}
The above code is the result handler from a flash remoting call. The object is declared, but with only one variable instead of 6 (name, adress, city... etc etc). Does anyone know how to declare an object in this matter?

Thnx in advance,

Steven

View Replies !    View Related
Data Types (I Think ?)
I have a question that is causing a serious problem. It has to do with classes, data types( I think?) and

data from XML.

Lets say I have the following function IN A CLASS FILE



Code:



public function RectangleTile(cx:Number, cy:Number, rw:Number, rh:Number) {

super(cx,cy);
rectWidth = rw;
rectHeight = rh;
createBoundingRect(rw, rh);
}
Right... ok so I create a new instance of it with the variables that are to be passed to it.




Code:

_root.engine.addSurface (new RectangleTile (300, 200, 100, 400));
Ok, this works as expected, and does EVERYTHING I want it to do (properly) but.......

If i take data from an XML file such as this :



Code:

<myXML>
<rect x="300" y="200" w="100" h="400" />
</myXML>
I parse it like this......



Code:

var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function() {

trace ("test") //It outputs this
with (_root) {
x = myXML.firstChild.firstChild.attributes.x;
y = myXML.firstChild.firstChild.attributes.y;
w = myXML.firstChild.firstChild.attributes.w;
h = myXML.firstChild.firstChild.attributes.h;

this.engine.addSurface (new RectangleTile(x,y,w,h)); /*

THIS DOES NOT WORK FOR SOME REASON!!

*/
}
}
myXML.load ("xmlFile.xml");
So really, my question is, is there anything different about the variables parsed in XML, and the

variables that are just defined in _root ?

My guess is maybe the data-types, cause on the function in my Class file, i was using strict data-typing.

It works when i just call the function in _root, by just entering numbers, but when i use variables

parsed from XML, it doesnn't do anything.


If anyone knows what data-type that I would be dealing with, it would be a great help.

Also... I am not even sure if data-typing is my problem


Thanks in advance for any help, I won't be on for about 8-10 more hours.

View Replies !    View Related
LoadVariables And Data Types
Is there a way to use loadVariables and get expressions rather than literal strings?

View Replies !    View Related
XML Data Types & If Statements
I'm having trouble getting my conditional statement to recognize the value of an XML item, and I assume it is due to a data typing issue. For example,


Code:
myVar = _root.questionList.firstChild.childNodes[0].childNodes[4].childNodes;
trace(myVar); // here, myVar traces as the letter "c".

if (myVar == c) {
trace("it equals c"); // This never traces
}
if (myVar == "c") {
trace("it equals c"); // This never traces
}

if (String(myVar) == c) {
trace("it does"); // This never traces
}

trace(typeof(myVar)); // this reports "object"
What am I missing?

View Replies !    View Related
Can I Use Custom Data Types
Hi:


Please bear with me I'm coming from the C++ environment and I'm trying to learn AS 3.0. In the C++ one can easily define and group data into custom data types (using struct or typedef). So I'm wondering if that is possible in AS 3.0 as well?

Something when I could define a single variable, say:
Code:
struct CustomType{
var i1:int;
var i2:String;
}
and then:
Code:
var v:CustomType;
v.i1 = 1;
v.i2 = "Hello world";

View Replies !    View Related
Casting Data Types From XML To AS 3.0
Hey guys,

I was just wondering if it's possible to cast standard AS 3.0 data types other than Number, int, uint and String from XML. I experimented with this:


ActionScript Code:
var xml:XML = <root_node>
    <number_node>12.9876</number_node>
    <int_node>321654</int_node>
    <string_node>this is a string</string_node>
    <boolean_node>false</boolean_node>
</root_node>;

var number_node:Number = xml.number_node;
var int_node:int = xml.int_node;
var string_node:String = xml.string_node;
var boolean_node:Boolean = xml.boolean_node;

trace(number_node); // returns 12.9876
trace(int_node); // returns 321654
trace(int_node * number_node); // returns 4177513.4904
trace(string_node); // returns this is a string
trace(boolean_node); // returns true (AS 3.0 default)

If it's only numbers and strings, would it be possible to use remoting and and something like AMFPHP, WebOrb, Zend Framework, etc. with MySQL to store other datatypes? Is there an easy solution?

View Replies !    View Related
XML To Array, Data Types
I've been creating Arrays from XML documents and I think I'm missing something with how the values are typed. For instance, if I create an Array from a simple XML structure like:

<test>1</test>
<test>2</test>

When I populate the Array with these values, sometimes they act like numbers but sometimes they don't. For instance, I can set a Number variable equal to one of these values and it seems to work. But if I try to add or subtract I get the non a number thing. Also, if I run a typeof() on these, they are objects, not numbers.

So I may have answered my own question here, but can anyone confirm - do I need to indicate the data types when they get put in the Array? How would I do that? Thanks in advance.

View Replies !    View Related
XML To Array, Data Types
I've been creating Arrays from XML documents and I think I'm missing something with how the values are typed. For instance, if I create an Array from a simple XML structure like:

<test>1</test>
<test>2</test>

When I populate the Array with these values, sometimes they act like numbers but sometimes they don't. For instance, I can set a Number variable equal to one of these values and it seems to work. But if I try to add or subtract I get the non a number thing. Also, if I run a typeof() on these, they are objects, not numbers.

So I may have answered my own question here, but can anyone confirm - do I need to indicate the data types when they get put in the Array? How would I do that? Thanks in advance.

View Replies !    View Related
Using XML Data - Question About Types
Hello

What's the best way to integrate xml data so that it is treated as a number

I can declare the following

var val:Number;

and then read the value in from a .xml file

If I do this in the following example, flash seems to convert newVal to a string when I want a number

I assume this is because val is a value read in from a .xml file:

var newVal:Number=0;

for(var i;Number=0;i<10;i++){

newVal+=5+val;

trace(newVal);}

How can I get flash to treat val as a number and yield a numeric result rather than a string of numbers

View Replies !    View Related
Xml, Arrays And Data Types
I'm making a website for a DJ. He wants a calendar on it which will show people when he has a show booked so that they don't bother calling him asking for days when he's busy. This sounded simple enough. I built all the calendar, an SQL database to store the days currently booked and an PHP page to get the data from the database and format it into XML for Flash to read.

The calendar is set up as a movieclip for the year which contains movieclips for each month which, in turn, contain movieclips for each day. Like this: http://www.dynamicentry.co.uk/stuff/calendar.jpg. Each has an instance name 'y2009' for the 2009 year movieclip, 'd04' for the 4 day of a month... So the 1st January 2009 would be 'y2009.m01.d01'. Each of the day movieclips has a blank version on frame 1 and a version with 'Booked' stamped accross it on frame 2. So inorder for a day to show as booked, we need to move it from frame 1 to 2.

So I make the XML file (i'll just post the result since the PHP query to get the data works fine):

Code:

<?xml version="1.0"?>
<bookings>
    <books day = "y2009.m01.d01"/>
</bookings>


So far, so good. I've got the reference I need to make a booking on January 1st 2009. Then I wrote the Flash side:

Code:

var bdayarray:Array = new Array();
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onLoaded);

var xml:XML;

function onLoaded(e:Event):void {

   xml = new XML(e.target.data);
   var cl:XMLList = xml.books;
   for (var i:Number=0; i<cl.length(); i++) {
      bdayarray.push(cl[i].attribute("day"));
   }
   
   for (var n:Number=0; n<bdayarray.length; n++) {
      var cd;
      cd = bdayarray[n];
      cd.gotoAndStop(2);
   }
}


loader.load(new URLRequest("bookings.php"));

Looks good to me. No luck though. I did a few traces and got some results. When I traced bdayarray[0] after the populating it in the first loop, I got 'y2009.m01.d01' like I was expecting. Surely this is fine, as that would make the line 'cd.gotoAndStop(2);' mean 'y2009.m01.d01.gotoAndStop(2);' like I want. But then I tried tracing 'y2009.m01.d01' and got '[object daybox_18]'.

Uh oh. I think I know what the problem is. I think the XML is coming though as the wrong type of data, possibly as a string rather than as a reference to the object I want. Does anyone know how I can convert the XML data into what I actually need it to be?

Thanks in advance for any help.

View Replies !    View Related
Problem With Data Types? I Am Not Sure Need Some Advice.
I moved this to the Actionscript 2.0 thread as i am working in mx04 and had misposted in the incorrect forum


Link to new post;
http://www.actionscript.org/forums/s....php3?t=134241

hopefully i will see a response in the proper forum.

J

View Replies !    View Related
Problem With Data Types? Im Not Sure Whats Up
Hi all

I've posted this on another forum (were-here) but that place seems all but abandoned. Not sure what happened, it used to be a kicken forum.

Anyways i am building an image gallery, i have written a script that is supposed to go through and unload the movieClip for each of the thumbnails that were loaded. Here is the function;


Code:
var itemVar = "item";

function clearAndLoad () {

for (var i=0; i<item_count; i++) {

var currThumb = itemVar + i;
unloadMovie (item_mc.currThumb);
}
loadXml ();
};
This does not unload any of the thumbs on stage but when i change the function and just target a specific Thumbnail it works and removes the one i targeted ie;


Code:
var itemVar = "item";

function clearAndLoad () {

for (var i=0; i<item_count; i++) {

var currThumb = itemVar + i;
unloadMovie (item_mc.item0);
}
loadXml ();
};
Is this a datatype issue? I have tried changing var currThumb to var currThumb:Object = .... as well as trying the String type.

I dont what could be going wrong, a trace of currThumb seems to output the correct values as well item0 thru item5 (in this case there were six thumbs)

can anyone shed some light on this for me?

Thanks
J

View Replies !    View Related
Function Accepting Two Data Types
Hey all,
I want to have a function that can accept either a string or a movie clip and executes slightly differently depending on which is passed to it, but not really different enough to warrant a whole 'nother function. I have tried two functions called the same but with different parameters and it didn't work. Thanks

--Surgery

View Replies !    View Related
Complex Data Types From PHP To Flash
Does anyone know of any really easy and effective ways to move complex data types from PHP into FLASH and vice-versa? A while back I made an attempt to recreate PHP' serialize() function in actionscript but it was really difficult and performance was poor.

I'm able to do it fairly easily for one dimensional arrays indexed by numbers, but when I have to pass either an object (or several objects) or when i have to pass a nested array of arbitrary complexity (such as a data tree) then I get bogged down.

I have a little experience dealing with XML in flash (working with the tree component) but it seems like so much effort when i am dealing with a new data type.

Does anyone know of any pre-packaged components or code (in actionscript and complimentary part in php) that might be useful?

View Replies !    View Related
Problem With Abstract Data Types
Hey everyone...
I'm new to OOP with Actionscript, and i guess i understand the basics, but the following costed me half the day and i still don't understand it:

I have two classes, Node.as and Player.as.

I have this public function in my Node class:

Code:
public function getName():String {
return nodeName;
}
Now in the constructor of my Player class, i want to access this function:

Code:
public function Player(startNode:Node) {
trace ("node: " + startNode.getName());
}
The interesting part of my main actionscript:

Code:
var q:Node = new Node("q", 150, 225);
var player:Player = new Player(q);

My constructor always traces "node: undefined".

So did i make a stupid mistake somewhere or is it just not possible to use classes in this way?

View Replies !    View Related
AS3 - [AMV2] Primitive Data Types
I wasn't sure where to post this question because there doesn't seem to be a suitable forum for it, so I've plopped it in the ActionScript forum for now.

I'm currently learning how to read/write ActionScript Byte Code (ABC) so that I will be able to read/write SWF files. The primitive data types used within the ABC format are a bit odd so I just need to confirm that I am using them correctly.

The u32 data type is described by Adobe like this:

"The type u32 represents variable-length encoded 32-bit unsigned integer value."

Simple enough... until we get to the part about reading and writing u32 values:

"The variable-length encoding for u32 uses one to five bytes, depending on the magnitude of the value encoded. Each byte contributes its low seven bits to the value. If the high (eighth) bit of a byte is set, then the next byte of the abcFile is also part of the value."

Now I'm assuming that the high (eighth) bit of each byte is the first bit in the bit sequence, so the X in the following byte would be the high bit... X0000000.

This is the code I am currently using to read a u32 value:


Code:
var value:uint = 0;

while( true )
{
var byte:uint = source.readUnsignedByte();
value += byte & 127;

if( ( byte >> 7 & 1 ) == 0 )
{
break;
}
}
I'm just looking for someone to tell me if that is the correct way to read the value because I seem to be getting some strange values returned.

Also, this is what Adobe say when it comes to signed values:

"In the case of s32, sign extension is applied: the seventh bit of the last byte of the encoding is propagated to fill out the 32 bits of the decoded value."

Is it possible for someone to give that to me in Layman's Terms because it isn't making much sense to me at the moment.

Thanks.

View Replies !    View Related
Object Types?
So, when you "typeof()" something, and it's an object, it will return "object" as the type. Does anyone know of a way to find the actual object type, especially with "homemade" objects?

View Replies !    View Related
[F8] Saving And Loading Complex Data Types
I have a need to turn a collection of complex data types into a string that can be saved using a server side php script then be able to load it back again.


I don't want to change the PHP script at all?

this is an example:
PHP Code:




myArray[5]={mo:"mike", me:{moor:"morges", meat:"mooe", ahdjsfkg:"agsdl"}};







don't forget the array!

TYVM

Mistron

View Replies !    View Related
Sending Complex Data Types To Amfphp With As3
Hello,

Has any one figured out a good way to send complex data types to amfphp yet? It seems like the functionality to send Arrays, Objects, and custom classes up stream has become a little tricky in AS3.

The problem, as I understand it, is that the basic complex data types in AS3, like Array and Object, have become "looser" and now behave more like a custom class then a true data type.

My first thought was to treat like a custom class in amfphp, but according to the instructions here: http://amfphp.org/docs/classmapping.html , It requires the use of Object.registerClass which is not in the standard Actionscript library any more.

I could probably get an array up there by serializing it w/ .toString() then explode() it in php, but this not an ideal solution due to the processing overhead and added development time to create custom serializers for my Objects.

Have any of you crafty fellows out there come up with anything yet? If so, I would appreciate greatly any and all suggestions. Even if its just a hunch.

Thanks for your time!
...aaron

PS: Here is some code I've been playing with that will demonstrate the issue.

AMFPHP Service

PHP Code:



<?php
//AMFPHP VERSION 1.2
class TestService {

    function TestService()  {
            // Define the methodTable for this class in the constructor
            $this->methodTable = array(
                "testMethod" => array(
                    "description" => "This is a description",
                    "access" => "remote"
                )
            );
        }
    
    function testMethod ($data) {
    
        ob_start();
        var_dump($data);
        $buffer = ob_get_contents();
        ob_end_flush();
            
        return $buffer;
    }
    
}
?>




Flex 2 Sample App

Code:
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script><![CDATA[

public function callRemoteMethod():void {
var gateway:NetConnection = new NetConnection( );
var responder:Responder = new Responder(handleResponse, handleError);

gateway.connect('http://localhost/amfphp/gateway.php');

var temp:Object = {var1:"Hello", var2:"World"};
gateway.call( "TestService.testMethod", responder, temp );
}

private function handleResponse( result:Object ): void {
idText.text = result.toString();
}

private function handleError( result:Object ): void {
idText.text = result.toString();
}


]]></mx:Script>
<mx:VBox width="100%" height="100%">
<mx:Button label="GO" click="callRemoteMethod()"/>
<mx:TextArea id="idText" width="100%" height="100%" />
</mx:VBox>
</mx:Application>
A few examples:

Object:
var temp:Object = {var1:"Hello", var2:"World"};

Response:
Error #2044: Unhandled NetStatusEvent:. level=error, code=NetConnection.Call.BadVersion

Array:
var temp:Array = [1, 2, 3];

Response:
Same

But if I do this:
var temp:Array = [1, 2, 3];
gateway.call( "TestService.testMethod", responder, temp.toString() );

Response:
string(5) "1,2,3"


---
Thanks for taking the time to read all this. I'm looking forward to your ideas!
=D

View Replies !    View Related
.NET Web Service Interoperability Data Types For Flash
I'm implementing a web service which will be used by clients from different platforms. I would like to define .NET properties instead of public members for all my return data objects.

Can clients from all flash consume return data in the web service which is generated from .NET data class which only contains public properties?

Second, what types of data cause trouble for interoperability?

cheers and thanks for your help.

View Replies !    View Related
.NET Web Service Interoperability Data Types For Flash
I'm implementing a web service which will be used by clients from different platforms. I would like to define .NET properties instead of public members for all my return data objects.

Can clients from all flash consume return data in the web service which is generated from .NET data class which only contains public properties?

Second, what types of data cause trouble for interoperability?

cheers and thanks for your help.

View Replies !    View Related
Kirupa's Abstract Data Types Tutorial
Its been a while since my last post, i've been very busy with my school and work that i barely have time to open flash.

Here's my Question:

Can somebody tell if its posible to make an edge just one way and how ?

An example of what im asking for its like this:

Let's pretend i have 3 nodes: a, b and c, and 3 edges "a-b", "b-c", and "c-a"

if i select a and c the path selected is "c-a" instead of "a-b", "b-c".

View Replies !    View Related
Importing Multiple Data Types From A Text File
I have a text file where I want to pull out multiple variables of different types.

Take for example the following

GalleryActive = true;
ImageDirectory = "Interior";

subGallery[1] = Before;
subGallery[2] = Construction;
subGallery[3] = After;

Images[1] = 15; // number of images in sub gallery "Before"
Images[2] = 10; // number of images in sub gallery "Contruction"
Images[3] = 17; // number of images in sub gallery "After"

MainHeader = "The Gradow Estate";
SubHeader = "Exploring the Interior";

I have pulled arrays out of a file before with parsing, but this was only an array and not multiple variables including arrays. Can anyone help me with this? I'm not even sure if this is a good listing convention. Basically I need to import this data from a text file and I was wondering if anyone could show me some sample code for this?

Thank you in advance.

View Replies !    View Related
2 Basic Questions - Data Rates And File Types
Greetings! Started using flash to help my boss with his website and he's asked me two questions I don't know the answer to!

1. What is the opportune data rate for the general population for videos when using flash? He has a small production company and most of the people he is selling to have cable if not T1+. I've advised a data rate of 300 kbps (but that would have to include audio too )... does that seem right to you?

2. It currently takes a VERY long time for me to export a movie to test it and see how it all works and looks. Currently all of the pictures in the system are in .PSD format. If I were to make these all JPEGs and swap them all out for these smaller files would this help reduce export time at all?

Thanks so much!

View Replies !    View Related
Trigger Code Hinting On Strict (or Strong) Data Types
Hey!

I've seen Lee get back the code hints whenever his is typing some code on the timeline. For instance

var bmp:BitmapData = new BitmapData(foo._width, .... get back code hints here!, ...... );

What is the command/key stroke to get those back? I tried hitting control-spacebar like the livedocs say, but that only works if no params have been entered.

Any help?
cheers.
:)

View Replies !    View Related
What Types Of Objects Can Be Included In A Textarea Object?
Can an image and/or a button be included in a textarea? I am trying to create something that acts like a popup window but using a textarea, and I want to be able to give the users a visual way of closing/hiding the window by providing an "X" at the top right of the textarea. Can this be done? If I can include images and/or flash buttons, is there an easy way to position it in the top right hand corner?

Thanks.

View Replies !    View Related
Radio Button Data Is "[object Object]" When Using Formmail.cgi
I'm making a form in Flash and using formmail.cgi to email the results. Everything works so far except the radio buttons; the data sent for them is "[object Object]". How do I get it to send the actual data?

View Replies !    View Related
Please Help Getting Data Out Of XML Object?
Hi,

I am very new to XML. Below is where I'm up to. I am struggling to trace out the data like. Can someone help me with my paths to the various parts? I'm not sure if it is due to Flash code or the XML structure that is causing the problem.

Many thanks

Ol
__________________________________________________
__________________

I have uploade the XML here:

http://www.araj21.dsl.pipex.com/dealers_RO.xml
__________________________________________________
__________________

// FLASH CODE
dealers_xml = new XML();
dealers_xml.onLoad = startMovie;
dealers_xml.load("dealers_RO.xml");
dealers_xml.ignoreWhite = true;
//
// Show the first slide and intialize variables
function startMovie(success) {
if (success == true) {
//trace(dealers_xml.firstChild.firstChild.firstChild );
//trace(dealers_xml.firstChild.firstChild)
trace(dealers_xml.firstChild.firstChild.firstChild )
}
}

View Replies !    View Related
Data From Shared Object - Using Elsewhere
Hi all,

I have a dynamic text field on the stage which loads the data from my shared object (a word). This works great but I'd like to get my movie to jump to a certain label depending on what that word is. For example if the shared obeject puts "Jump" into the dynamic text field I'd like the movie to jump to the label "Jump".
I have tried a number of ways to do this including using an "if" statement etc, but can'tget it to work.
Do I need to convert my data (which is a string) into a variable or something before I can make the jump or is there a easier way.


__________________
Thanks in advance

Sambora

View Replies !    View Related
Remove Data Object :s
if

Code:
var user = SharedObject.getLocal([_global.rqstid]);
//update!
user.data.y = user.data.y+3;
user.data.x = user.data.x+6;
user.flush();
comment est-ce que vous faisez le enlevez?

View Replies !    View Related
Object Data Type
I ve created a variable that contains an array. Each array element is a generic object that further contains an array n that array again contains a generic object whith .x and .y properties.. Now i wanted this to pass to the asp. the problem is that i cant extract the .x and .y values frm the variable passed in asp.. Please tell me what to do so that i can get the values ....thnx in advance

View Replies !    View Related
AS2 Unload XML Data From Object
Finally remembered my password for this wonderful forum to bother you with yet another (stupid) question...my 2nd already, lets hope it works...

AS2 XMLObject1 loads 15 pics. XMLDriven menu button (XMLObject2) triggers loading of new XML (10 pics) in XMLObject1. Works fine but last 5 pics stay in XML Object. In other words: I need to unload all the previous XML data on an onRelease event. Tried (thanks to this Forum) new XMLObject, delete (Old) XMLObject (Did not work...). There is no unload XML Method so what to use?

Thanks! Please let me know if you need more info..(which you probably do)

View Replies !    View Related
Flushing XML Data From Object
Actionscript 2.0 in Flash CS3

I downloaded a simple xml based photo gallery, but I want to categorize the content. Basically the data gets pushed into the object, and when i click a new category button I want it to begin showing the photos only in that category (which is a separate XML file).

The problem I am having is that when i click a new category it doesn't replace the XML data of the object, it appends to it. So it continues to show the original category and then shows the new category after it gets done and then eventually goes back to the original. For example, it starts playing CatOne01.jpg from CatOne.xml, CatOne02, 03 - 10... etc... at the end it goes back to CatOne01

If you click on category 2, it loads CatTwo.xml (I watched it all load up in firebug)and it finishes playing through CatOne CatOne10.jpg and then plays CatTwo01.jpg-CatTwo10.jpg and goes back to CatOne01. I need to find a way to clear out the data before it pushes the new data from the new XML file. I tried flush (as shown below) and nothing changes, i tried delete XML, and that just makes it go blank onclick. All I need is for the values from the first xml to be flushed out before the new values are pushed in each time the user clicks the category buttons, and the new category's images immediately begin playing.

Any suggestions?


Code:
on (release) {
gotoAndStop(1);
_root.techtype.flush();
_root.caps.flush();
_root.photos.flush();

var feed:XML = new XML();
feed.ignoreWhite = true;
feed.onLoad = function(){
var nodes:Array = this.firstChild.childNodes;
for(var i=0;i<nodes.length;i++)
{
_root.techtype.push(nodes[i].attributes.id);
_root.caps.push(nodes[i].attributes.desc);
_root.photos.push(nodes[i].attributes.url);
}
_root.mcl.loadClip(photos[0], _root.gallery.photo);
_root.textBar.t.text = caps[0];
_root.buttons.gotoAndStop(techtype[0]);
}
feed.load("images/CatOne.xml");
}
and


Code:
var photos:Array = new Array();
var caps:Array = new Array();
var techtype:Array = new Array();
var current:Number = 0;

this.createEmptyMovieClip("gallery", -99999);
this.gallery.createEmptyMovieClip("bmdc", 1);
this.gallery.createEmptyMovieClip("photo", 2);

var bmd:BitmapData = new BitmapData(500, 375,true,0x000000);
this.gallery.bmdc.createEmptyMovieClip("preload", 1);
this.gallery.bmdc.attachBitmap(bmd, 2);

var mcl:MovieClipLoader = new MovieClipLoader();
var mclL:Object = new Object();
mclL.onLoadComplete = Delegate.create(this, tranny);
mcl.addListener(mclL);

function loadPhoto():Void
{
trace("loading photo...");
bmd.draw(this.gallery.photo);
this.gallery.photo._alpha = 0;
if(current == photos.length-1) current = 0;
else current++;
textbar._rotation = rr;
textBar.t.text = caps[current];
mcl.loadClip(photos[current], this.gallery.photo);
_root.buttons.gotoAndStop(techtype[current]);
}

function preload():Void
{
if(current == photos.length-1) var num = 0;
else var num = current+1;
this.gallery.bmdc.preload.loadMovie(photos[num]);
}

function tranny():Void
{
trace("starting transition...");
var f:Fuse = new Fuse();
f.push([{target:this.gallery.photo, alpha:100, time:4},
{target:textBar, delay:0.5, start_x:-518, x:cx, time:0.5, ease:"easeOutExpo"},
{target:textBar.arrow, x:ca, time:0.5, ease:"easeOutQuad", delay:0.5}]);
f.push({func:preload, scope:this});
f.push({target:textBar,delay:5, x:-518, time:1, ease:"easeOutExpo", func:loadPhoto, scope:this});
f.start();
}

function cx():Number
{
var te:Number = textBar.t.textWidth;
var nx:Number = -518 + te + 60;
return nx;
}

function ca():Number
{
return textBar.t._x - cx()+27;
}

function rr():Number
{
if(Math.random() < 0.5) return Math.round(Math.random()*15);
else return Math.round(-Math.random()*15);
}

View Replies !    View Related
Data Tree Object
Is there any way to access the data in a data tree Object without knowing the names of the "branches"? or how many there are?

View Replies !    View Related
Displaying A3D Object With Its Z Data In CS4
Greetings all,

I have a problem, i set Z properties for a display object, but its ChildIndex wouldn't display based on its Z in Scene3D in Papervision3D. and if 2 display objects are over each other, only that object stands over the other one which its ChildIndex is higher not its Z. How can i solve this problem in CS4?

Thanks

View Replies !    View Related
Sending Object Data Through LocalConnection
has anybody had any dealings with sending objects through localConnection? i can't seen to manage it. does it only send no complex data such as strings, arrays, booleans and number values?

View Replies !    View Related
Shared Object, Parsing Data, XML
Hello,

Someone mentioned I should look into shared objects since I want to have data stored locally through a flash interface. I found one example and got it working. Now I want to take the next step.

1) Are there any useful Shared Object methods I should be aware of?

Is it possible to put a list of values within 1 variable and then have Flash parse these values into designated sub variables? For example, I am trying to find a way to organize names of stations. Let's use band names instead. The main variable could be "B", for bands starting with the letter B. If someone adds "Beatles", and then "Beach Boys", I would like to have those two in the B variable, but I also want to assign them to their own variable, B1 and B2. Furthermore, is it possible to alphabetize so that "Beach Boys" is assigned to B1, not B2, even if it is added second?

2) If possible, how can I best parse data?

This now leads me to XML. I hear a lot mentioned about it, but so far a regular .txt file and now .sol file is sufficient enough now to add and read data.

3) What advantages would there be to integrate XML into what I have mentioned above, and do you think it is worth it?

View Replies !    View Related
Looping Through Shared Object Data
Hello,

I'm trying to build an abstract shared object read function and I'm trying to treat the shared_object.data object as a regular array but it doesn't respond as such.

Here's what I'd like to see happen or something similar:

var shared_object = SharedObject.getLocal("user_data");

//--- read the contents of the shared object ----
for( var i:Number = 0; i < shared_object.length; i++ )
{
trace( shared_object[i] );
}
//-----------------------------------------------------



Thanks for your help,
Clem C

View Replies !    View Related
Shared Object Data Available For Others Swf In The Same Page?
Hello people,

sorry about the nooby question, but i wantted to know:

are flash cookies with a shared object available for others swf (not the original one who created it) liying on the same page?

if its posible, how can i retrive the data i stored from another flash?

thanks a lot.

View Replies !    View Related
Is Anybody Familiar With The BitmapData Data Object?
The maximum width and maximum height of a BitmapData object is 2880 pixels.
does anybody know if there is a way to increase this?
Can't properties to some built in classes be changed with the .prototype function or something?

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved