Events on the getter/setter function binding
I found this snippet, when I was walking in a Flex3.6 project: What is it meant to do by declaring an event that can be bound above the getter function immediately? Thank you very much. [Bindable(event='currentPageChanged')]
public function get currentPage ():int {
return this._currentPage;
}
protected function set _currentPage (value:int):void {
if (this._currentPage == value){
return;
}
this.__currentPage = value;
this.dispatchEvent(new Event(BookEvent.CURRENTPAGE_CHANGED));
}
protected function get _currentPage ():int {
return this.__currentPage;
}
No, var age: int = classname.age; will be re-run. But lets think about that for a second, when classname.age is changed, what is the State of 'age', he might be out of range, or specify a different value, and so on. DataBinding usually manifests in mxml components tied to the data they represent. If you want to link 'age' classname.age then you must use BindingUtils and implement binding yourself, it is not difficult but can be weird with its syntax in the beginning.
Tags: Flex
Similar Questions
-
Table 2D-strings in the "get/set item property.
I am porting the code of veristand 2009-2010 and I noticed that the get/set vi item property does not the same. Specifically, I can't write or read 2D strings sent as variants. When I put the 2D table in a cluster, it works fine. Does anyone have information on this?
JY
Hi JY,.
This problem was reported to R & D OR as a Corrective Action Request (CAR) 287960 for further investigation. Thanks for the comments!
-
prototype allows to substitute the get/set accessor?
Is - this there anyway use the prototype to override a getter/setter? I know that you can override the functions as follows:
prototype.toString = function()
{
// statements
};I was wondering if it is possible to do the same thing with a getter/setter? If so, what is the syntax?
Thank you
j
No way to add running replacements, or change the class definition at run time or even create new classes at runtime, unless you build through the old regime of prototype classes, that use without Flex classes.
Alex Harui
Flex SDK Developer
Adobe Systems Inc..
-
How to manage the getter and setter in flex?
I want to create getter and setter for a shared variable ways. How to create aid may be related?
and how to call the accessor get and Set of a class of model?
for ex:
(1) in the IDMLEditor.mxml file
[Bindable] public var currentDoc:IdmlDocument = null;
private var _currentDoc:String;
[Bindable]
public function get currentDoc (): {IdmlDocument}
return currentDoc;
}
public function set currentDoc (idmlDoc:IdmlDocument) {}
this.currentDoc = idmlDoc;
}
(2) how to get from EditorModel.as?
public class {EditorModel}
[Bindable] public var currentDoc:IdmlDocument = null;
You don't need to use underscore (_) to access the variable in the getter, setter class. You can immediately access the variable by using the name of the method
myClass.currentDoc
That's all
-
I try to use a Set accessor for two reasons: to set the value of a variable and execute a method. However, when I call the setter of a value where the variable does not change, the Set accessor is unable to run.
public function set {canvasPosition(value:Number):void}
_canvasPosition = value;
model .canvasPosition = _canvasPosition;
}
Presumably, the variable leans on its value and said to himself: "my value does not change, so there is no point in the execution of the Set accessor.My solution is to call the setter twice:
controller.canvasPosition = 1;
controller.canvasPosition = 0;This action solves the problem, but there must be a better way! How can I force the installer to run?
If you accidentally set the predefined function or class it
can be generated code that calls not less that the value has changed.
Otherwise, any change control must be in your code.
Get/set functions, use [Bindable ("someEvent")] and dispatches the event
themselves.
To prove it, add a trace statement that transforms the old and the new value and see
If we trace when the value does not change.
-
Why the HTTP become function returns the error code 63?
I tried to use the get HTTP function to get the XML file is returned by the api Google MAPS distance-matrix. I got the right answer if I insert the url directly in the browser, but using the get HTTP function, it returns the error 63, why?
This is my code (the VI is developed on LV2011).
I guess, the VI GET for use with LabVIEW Web Service, only not to get of the Internet pages.
Using the simplest way:
Andrey.
-
Public/private getter/setter methods
Hello.
When you create a custom in an .as file class, I said getter/setter methods using the get/set keywords. When I do the public methods, said Flash there is no errors, but if I do one any of them private, I get the following error message:
"A member attribute has been used correctly."
So far I have not found an explanation to do this, is there a requirement that all the methods getter/setter be public? Does not make much sense to me, but maybe there's a reason for that (if it is indeed the case that they should be public).
Thanks in advance.I think so
getter and setter is designed for the manipulation of the Member variables private without making them directly exposed to the outside world.When you can access all the stuff in your private class public why you want private getters setter?
-
binding of events and get accessor function
I found this snippet, when I was walking in a Flex3.6 project:
[Bindable(event='currentPageChanged')] public function get currentPage ():int { return this._currentPage; } protected function set _currentPage (value:int):void { if (this._currentPage == value){ return; } this.__currentPage = value; this.dispatchEvent(new Event(BookEvent.CURRENTPAGE_CHANGED)); } protected function get _currentPage ():int { return this.__currentPage; }
What is it meant to do by declaring an event that can be bound above the getter function immediately?
Thank you very much.
Here's the documentation:
http://livedocs.Adobe.com/Flex/3/HTML/Help.HTML?content=databinding_1.html#110674
If you omit Bindable in Flex - change of ownership will not by the application.
Apart from Flex, it makes no difference for him is not used in any case.
-
get the structure of the event inside the while loop to wait for event occurs before the execution
Hello
I have a small problem, when I raise an event using a value change button, which works very well. The problem is that the VI does not wait for me raise an event and instead runs the same event again, even if I have not pressed the button to start again. The mechanical action of the button switch is released is.
I was wondering how you get the structure of the event to wait for a user event, after that he executed the first time.
James.Morris wrote:
There is no reason that the event should be raised twice as much that the only way that it fires in your code is by the user by clicking on 'Hall measure only'.
Oh yes, there is, and I deserve a kudo for this one. Mechanical action on the button is set on the switch until published, so click to generate an event, on the bottom and on the square, attached is an example.
My boy has my students hate this question, and to be honest, I hated it. When never would you do that intentionally? Honestly? Anyway to change the button back to normal (as default latch when released) and move the terminal button in the structure of the event where it is managed and it will work as usual.
-
event twice to get the answer, run
Hello, newbie here. I did a little routine to take an identification number entered by the user (usually 4 digits, but not exclusively as such) and structure of the event allows you to add an alpha prefix and this year as a suffix, and then displays the new string. I'm trying to get a handle on works the structure of the event, as well as text, strings and date functions. It works as it is, but I have to run the event twice to get the right result. Any suggestions or explanations are really appreciated.
PS I also noticed that the string functions and the text don't work in the same way. The control of the chain added whenever I entered a new identification number and didn't all of its contents to the CONCATENATE node would be out and I couldn't find a way to limit it to the current entry. The text control gives me what I want, but it appears in my 'Express', not classic or modern menu, which seems to have their own advantages in different situations of the screen formatting, etc. I guess I could build another function to extract the desired part but that seems like overkill. Any tips?
Thanks, Jim
That does what you want it to do?
You must have control of the string to be read inside the a case for event.
When you run your VI he read control of the chain before he expected in the case of the event. So if you do not enter the chain before you click on the arrow to run, you will not get the correct string. Then when you run the 2nd time the chain is already in control of the chain so he can read it.
That's why you had to run it twice.
-
How to get GMT or IST using the PL/SQL FUNCTION
Hello, I use Oracle 10 G database (operating system: Windows-32 or 64 Windows).
How can I get the date and time GMT or International without mentioning SYSDATE / DBDATE.
Real problem the DB Sever time is frequently manipulated by the end user and I would like to connect the actual date and time of the transaction in other audit tables.
Kind regards
TarunIt won't increase your load on the server, you would simply have many waiting http events and the performance of your application depends on your internet connection to customers. Something not very desirable if you ask me and certainly will cause you headaches. Really bad headaches, and one day someone will ask who came up with the brilliant idea to get the timestamp system via http instead of... + sysdate + (I smell a future article http://thedailywtf.com/).
In any case; That is: the http based sysdate function. I use mod_plsql to my 'webservice' running on a server where I'm sure the date is correct. You can use what you want, for a 'real' webservice implementation will be a little different. Google should know the answer about calling Web services from the data base.
$[CHE_TEST@asterix1_impl] create or replace procedure server_time as 2 begin 3 htp.print(to_char(sysdate, 'dd.mm.yyyy hh24:mi:ss')); 4 end; 5 / Procedure created.
As you can see the procedure does nothing else then exit the sysdate from my database server in a specified date format. I then call the procedure mod_plsql via utl_http on another server:
$[CHE_TEST@asterix2_al32utf8] create or replace function get_server_time return date is 2 begin 3 --default would be 60, this is clearly too much 4 utl_http.set_transfer_timeout(1); 5 return to_date(utl_http.request('http://ias4/asterix1_impl_cronet/server_time'), 'dd.mm.yyyy hh24:mi:ss'); 6 exception 7 when utl_http.REQUEST_FAILED then 8 return sysdate; 9 end; 10 11 / Function created.
Now get_server_time will give me the time of my first database server (unless the requested HTTP fails for any reason, then it'll be sysdate)
$[CHE_TEST@asterix2_al32utf8] select get_server_time from dual; GET_SERVER_TIME ------------------- 24.07.2012 13:35:00
Again, if you go in this way use the feature carefully and not at each end of your application as it will give you performance problems .
see you soon
-
The difficulty to access the get function class
Salvation;
I am writing a flash AIR application.
I have a class of document attached to a FLA to put the elements on the stage, he then instantiated and puts myClass1 one scene. MyClass1 puts more elements on the stage and sets the value of a variable _myValue to . MyClass1 also incorporates a public get accessor function that returns _myValue.
The class of document then instantiated MyClass2, which is a reference to MyClass1passed. MyClass2 must Access _myValue MyClass1.
The structure of following code generates an error. While not exact, the code below should show haw what it has been implemented. I condensed the code to make it understandable.
If you want to see all of the code, I'll try.
DocumentClass.as
package ui { import flash.display.Sprite; public class DocumentClass extends Sprite { public function DocumentClass() { var myClass1:MyClass1 = new MyClass1(); addChild(myClass1); var myClass2:MyClass2 = new MyClass2(myClass1); addChild(myClass2); } } }
MyClass1.as
package ui { import flash.display.sprite; public class MyClass1 extends Sprite { private var _myValue:int; public function MyClass1() { //some code to add stuff to the stage............................. _myValue = 10; } public function get myValue():int { return _myValue; } } }
MyClass2.as
package ui { import flash.display.Sprite; public class MyClass2 extends Sprite { public function MyClass2(referenceMyClass1:Sprite) { var ref:Sprite = referenceMyClass1; var myValue:int = ref.myValue(); } } }
It gives me an error
MyClass2.as, line 39 1061: call to a method may be undefined for myValue through a reference with static type flash.display:Sprite.
Thanks for your reply. It was one of the problems.
As it turns out another problem was:
public void MyClass2(referenceMyClass1:Sprite)
should have bee
public void MyClass2(referenceMyClass1:MyClass1)
-
Store events in the various tables / AVG function error
Hello
I have a very newbie question that I can't solve.
I want to store events in a database, well, but if I set the events on the context like this file:
< wlevs:event - type-repository >
< wlevs:event - type the type name 'Averages' = >
< wlevs:properties >
< name wlevs:property = "average_Generator1_ActivePower" type = "float" / >
< name wlevs:property = "sum_Generator2_ActivePower" type = "int" / >
< name wlevs:property = "max_Substation_Active_Power" type = "int" / >
< name wlevs:property = "number_events" type = "int" / >
< / wlevs:properties >
< / wlevs:event - type >
< wlevs:event - type the type name = "WindEvent" >
< wlevs:properties >
< name wlevs:property = "generator1_ActivePower" type = "int" / >
< name wlevs:property = "generator2_ActivePower" type = "int" / >
< name wlevs:property = "substation_Active_Power" type = "int" / >
< / wlevs:properties >
< / wlevs:event - type >
< / wlevs:event - type-repository >
They will be stored at the same table, TupleValues table.
I'm trying to work around this situation by defining one of the events as a class, and in this case the CEP Oracle create another table to store the event. But with this Setup, I have an error on the processor node, more exactly, in the avg function that use a property of the created class. Below it is the context, the class of java and the query file in the processor
Class #Java
public class WindEvent {}
private Generator1_ActivePower entire;
private Generator1_AverageExpectedEnergy entire;
private Generator2_ActivePower entire;
private Generator2_AverageExpectedEnergy entire;
private Substation_Active_Power entire;
private Substation_AverageExpectedEnergy entire;
file #context
< wlevs:event - type-repository >
< wlevs:event - type the type name = "WindEvent" >
< wlevs: class > oracle.cep.demo.events.WindEvent < / wlevs: class >
< / wlevs:event - type >
< / wlevs:event - type-repository >
< wlevs: adapt id = "adapter" provider = "csvgen" >
< wlevs:listener ref = 'channel' / >
< wlevs:instance - name of the property = 'port' value = "9001" / >
< wlevs:instance - name of the property = "eventTypeName" value = "WindEvent" / >
< wlevs:instance - name of the property = "eventPropertyNames."
value = "generator1_ActivePower, generator1_AverageExpectedEnergy, generator2_ActivePower, generator2_AverageExpectedEnergy, substation_Active_Power, substation_AverageExpectedEnergy" / >
< / wlevs: adjust >
< wlevs: channel id = 'string' - type event = "WindEvent" >
< wlevs:listener ref = "processor" / >
< / wlevs: channel >
< wlevs:processor id = "processor" >
< / wlevs:processor >
#query
< processor >
processor < name > < / name >
< rules >
< request id = "ExampleQuery" >
<! [CDATA [select avg (substation_Active_Power) got max_Substation_Active_Power, count (*) as number_events of the channel [line 60]]] >
< / query >
< / rules >
< / processor >
If someone could help him in both questions, I'll be very gratefulKeep your definition of class as -
public class WindEvent {}
private Generator1_ActivePower entire;
private Generator1_AverageExpectedEnergy entire;
private Generator2_ActivePower entire;
private Generator2_AverageExpectedEnergy entire;
private Substation_Active_Power entire;
private Substation_AverageExpectedEnergy entire;}
In other words, use integer instead of int.
Then, change the query for-
Select avg (* substation_Active_Power.intValue () *) as avg_Substation_Active_Power, count (*) as number_events of the channel [line 60]
-
How to get the events of the ItemRenderer
Hello, I have a little problem. In my application, I use a list and build its elements with an itemRenderer. In this itemRenderer I have on each line, 1 label and 1 button. When I press the button I want to send this event in my main application... How can I create a communication between myApplication and itemRenderer?
Thx for all
Max
You can use the code above. Let me know if you have any questions.
-
Passing Parms of event click the function and 'child '.
With the help on this Forum, I'm able to pass the parms in a custom context menu based on TitleWindow created with the PopUpManager to a click event. Now, I would also spend parms to change a Manager click on the PopUp itself event. Is this possible? Here is the code for the click event in the context menu:
From main MXML file - creates the PopUp:
private
var popup: owPopUp = new owPopUp();protected function owPopUpWindow (event: MouseEvent, title: String, url1:String):Sub
{
PopUpManager.addPopUp (popup,
ce , true );
Popup.title = title; title = '{text}' in the tag < s:TitleWindow... >.
Popup.x = 200;
Popup.y = 125;
}
Code for the click (a text in a text box) event
a click = "owPopUpWindow (event, '.
' New EBS: order writer - queue of Milestone 1' "lessons/EBS_new_Milestone1.swf" ) "//third parm is what I want to pass to the function in the PopUp TitleWindow (underline) .
In the TitleWindow PopUp created by the above code:
...
[
Bindable [ ] public var titleText:String =""; .
[Bindable] public var url1:String = "";
protected
function textarea1_clickHandler(event:MouseEvent):
Sub
{
ce .move (1,1);
Loader.Load)
'url1' ); This URL is where I would like to pass in a parm to the event click above 'url1 '.
}
protected function pdfLoader(event:MouseEvent):Sub
{
navigateToURL (new URLRequest (url2)); I would also like to pass parm for this URL 'url2.
}
The role of title works, but does not work part url1. No error, just no load. Any suggestions?
Thank you.
Create your own event accommodating more parms.
This is possible by creating a class that extends MouseEvent. Add some parms you need for this event and be sure to call super.
You can then send this event as need and also get the parms that you must listen to
#4 comment should help you.
Maybe you are looking for
-
iPhone 5 s incorrect password, but this is not
My emails are not being sent on my phone, but they are on my windows computer. I confirmed the password on the two parameters to icloud and msn. I forgot my security questions and was therefore blocked to enter my apple id page. So frustrated.
-
Also tried to disable virus protection, but nothing helped.
-
Designjet T120: Can't trace file size D (T120)-specific PDF drawing
Hi all Having problems trying to draw a PDF specific drawing D-size (SolidWorks saves) on our plotter T120. It plots just fine in the sizes A, B and C, but when I try D, it just hangs, then times out with an error. I tried to update drivers, run th
-
Pavilion dv7: recovery does not completely end
Replaced the bad hard disk 750 GB with a 500 GB hard drive. It cannot make recovery because the new disk is smaller than the old disk, make itself a 'Factory Reset'. All recovery disks are read without problems. Once I hit the button continue, th
-
I have a compac computer and told me that he might have a virus called the virus "snow white." What happens is when I start the PC, it goes to the start screen, and it's like he goes. I don't have all the disks of the computer and Im stuck and don't