ActionScript 3.0 :: AMF Class Mapping Of Getters Only
Sep 29, 2009
Dear goodness, am I the only person on the web trying to send a VO object from Flash to AMF where the properties are read only/getters? If I add a setter that does nothing but throws an Error it works. If no setting is present in Flash, it fails. Is there a way to send objects to AMF that have getters and not setters?
if getters and setters are the best option in a specific case. The case is when I have class 'A' instantiating classes 'B' and 'C'. Class A contains public getters and setters for classes B and C to access so data is centralised.Is this best practice or would it be best to pass the data to classes B and C through parameters?
I am building an application using Flex 4.5 and Zend_AMF as my AMF endpoint.I would like to map a class called CRequest in PHP to a class called Request in Flex.This is my php class:
I'll try to focus on the problem which takes place in a whole system.To sum up, I have 2 entities (MySQL) :
create table AAA ( id_AAA int not null auto_increment, id_BBB int,
[code]....
I retrieve all my BBB, they are mapped from PHP classes (generated by Propel) to AS3 classes on the Flex side.But when I create a AAA row in the database.I retrieve all my BBB, and all objects are mapped EXCEPT the BBB whose id corresponds to the foreign key in the inserted AAA row.
if you know anything about how AMFPHP / Propel / Flex are dealing with Foreign Keys and why class mapping is failing right here.The weird thing is that it seems to happen only for this specific case ...
I'm using Pyamf as my backend for my Flex app and I'm seeing some weird problems with the mapping of the stongly typed classes.[code]When I do that in Flex, I get my SouvenirAct objects are typed as they should be, BUT then the child souvenir objects are all null. So when I force the casting of the SouvenirAct objects in the return result, I get null for the child properties that are strongly typed.Has anyone see this before? Is there a different way I should be mapping classes?
Is there a way to synthesize getters/setters in AS3? It's very common that you have a class with lots of variables, especially in math calculations (Model in MVC pattern), that you'd like to expose. Is there something like synthesize property in Objective-C, that allows to generate getters/setters?
Is there a way to use getters and setters for Vectors?Say, in my Main class, I would like to write
myVector.push(item);
and in another class, I have written:
public function get myVector():Vector.<int> { return _opponentCardList; } public function set myVector(myVector:Vector.<int>):void { _myVector = myVector; }
This doesn't really work as you have to set _myVector to a Vector. But what if you just want to push(), pop() or splice?
public class AbstractTarget extends Sprite [codee]................
And then I have a class called "Target" that extends AbstractTarget...how do I access the __movement property? Do I have to write the getter and setter in my Target class also and override both functions/methods?
What's the best way around this problem with interfaces?
public interface ITest { function set testField(test:String):void; }[code]......
Test does have a setter for testField (an implicit one).I don't want to define an explicit one for every single field I have defined in my interface.There doesn't seem to be a way to define getters/setters in interfaces (or the syntax just escapes me).Do I have to do this explicit getter/setter nonsense in order to use interfaces in this way?
In the following: //track of whether the player has the key public function get hasKey():Boolean { return _hasKey; } public function set hasKey(keyState:Boolean) { //trace(keyState); _hasKey = keyState; } These functions don't even work until a value is passed to keyState in the set function correct? As you can see I did a trace keyState and the trace didn't return anything until it was true.
I've came across this compilation error a while ago.. As there's an easy fix and I didn't find anything relevant at the time, I eventually let it go.I just remembered it and I'm now wondering if this is really part of the language grammar (which I highly doubt) or if it's a compiler bug. I'm being purely curious about this -- it doesn't really affect development, but it would be nice to see if any of you have seen this already.
package view { import flash.display.Sprite; public class Main extends Sprite {
I have a class (Wall) that inherits from Sprite.Sprite already has width and height properties. But for wall, I need to do some other additional calculations when the properties change (f.e. make sure the new size won't cause it to overlap any other walls).So, how do I set the width property inherited from the Sprite class from within the width setter of the Wall? (or perhaps there is an alternative way to do my bounds checking whenever width is set?)[code]
The following code seems to create an ambiguity for the compiler (please see error commented near the bottom). Is it not possible to have getters and setters split between interfaces?
Is there a way to override the width (for a getter) on a Sprite?I see examples of how to override the setter but not the getterI need to do something like
override public function get width():Number { if (onecase) { return this width;
I don't understand why adobe set them up that way. As far as I can tell, all the setter does is change the value of the varible and nothing else. does anyone know why adobe set things up this way or what the x and y setter do other than changing the value of the varible?
I am plain stumped. I am working in F8/as2.0.I have a class that extends the MovieClip class. I have a blank_mc in the library that is linked to the class. Here is the constructor:
ActionScript Code: public function MyMC (target_mc:MovieClip){ var _mc:MovieClip = this; _mc = target_mc.attachMovie (.....); }
That works all fine and dandy. Where I am having issues is basically I have properties x, y that DON't overwrite the _mc's _x & _y props. Instead, the use getter & setters that take values and then calculate the needed number to set the actuall _mc._x, _y props. This doesn't seem to work at all and i don't know why. Here is the code:
[Code]
So I got this to work by NOT extending the MC. Instead I have a variable ref to a _mc prop in the class.However I am unable to set event functions to it even if I make some ref to the _mc prop. Is there a good way of approaching this by say a decorator pattern?
anyway im using flash as3 for about 6 months, and im still kinda confuse in this things like getters and setters, and idk what you call that but here's and example :
private function myBoolean():boolean { //codes here // {
idk how to use it, and what it differs from getters and setters,
Etiam nisi ligula, sodales non, pharetra eget, tempus ac, purus. Vivamus sagittis mollis risus. Proin dictum libero a elit. Curabitur feugiat, metus sit amet convallis imperdiet, est tortor volutpat nulla, eget mollis diam nisi vel lacus. In diam ligula, euismod eu, dapibus non, fermentum quis, urna. In consequat pede eget erat. Quisque luctus felis. Mauris dignissim. Fusce pulvinar, dolor sit amet porttitor egestas, quam massa tristique pede, nec porttitor diam odio in magna. Mauris congue mauris eu lectus. Duis eu felis ut ligula consectetur blandit.
<?php error_reporting(E_ALL | E_STRICT); //error reporting, not needed require_once "Zend/Amf/Server.php"; //the zendAMF server require_once "process.php"; //our test class
I'm building image processing or mapping system kinda like google map except we have our own HD images so i'm not sure what is the best way to do this in .NET here is what im trying to do Mapping web application build in .NET i've High resolution images , the user first load the selected area a full scaled image should be loaded 100% (original image) then he Zoom to the area he want, then he can move around this area almost like google map
1.user select area - full scaled image loaded
2.user zoom to random area - (i will receive some values for X, Y, etc.. in query string then i will extract these values and zoom/return the image based on these values)
So i'm not sure what is the ideal solution for this is it just zoom/re-size image based on the vales received from the user, or its more complicated than that?
which is the best flash mapping api (with good support and reasonable price) to use in my flash project. I have used UMapper �s Umap before but it�s too expensive for a commercial license and the support was not that good.
I'm new to flash and working to embed the flash player in a .NET application. It's going "well" for the definition of "well" that adding the COM control and getting it to play a movie was easy and took about 3 minutes.What's not going well is that I cannot find documentation on the variable to string mapping used the SetParameter variable parameter. To coordinate between the apps, I want to be able to say: "flashPlayer.SetVariable("flash_variable", "value_to_set"). Obviously SetVariable does this. What's not obvious is how "flash_variable" is constructed.
For example, in the actionscript for a button called "OneBigButton" I have the following code:
I'd love a pointer to the documentation on how namespaces, class instances, etc affect the string construction used in SetVariable and GetVariable as I can't find it anywhere.
When I login a new session is generated. How can I later know for which login the session was generated? I am getting the session value, but how do I know which user the session is for and redirect him to that page?