Actionscript 3 :: Class Property Data Validation With Annotation?
Jan 13, 2011asp.net mvc has something that allows for class property validation using annotation.
is there a similar thing in actionscript?
asp.net mvc has something that allows for class property validation using annotation.
is there a similar thing in actionscript?
In my app, I have a button bar with data provider as an arraycollection and a text field. I want to validate user input in the text field based on the item selected in button bar. my sample code is like this....
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Code]....
We are using Hibernate, BlazeDS and Flash Builder 4.0 for Application development. We have a problem in Data validation submitted by User. We have a Employee table. We need to enter the EmployeeId and Name in the form. We need to have two levels of validation. One is to check the user entered proper text which can done by validator components. The Second one is to check whether the Entered Id is already existing or not.
After checking the validation we will insert in the Database Table. For the second one, We have created a method in Hibernate and referring through BlazeDS. Now our problem is, In our Action Script we are passing the entered data into the Method and getting the return value. Depending on this we are inserting. The subsequent code is getting executing before getting the return value. Our code as follows:
Code:
protected function empIdCheckResult_resultHandler(event:ResultEvent):void {
IdCheck.text = empIdCheckResult.lastResult;
} btnSubmitClick() {
empIdCheckResult.token = opteDestination.empIdCheck(dgEmpId.text);
idCheck.text = empIdCheckResult.lastResult; /* This step taking time, setting the Variable after some time and the Script executing next step in the code*/
if(IdCheck.text != "0") {
//Some Function
} else {
// Some function
}}
i have set up a data validation file in fmx and when the data is valid i want it to go and play the "preview" frame, but if it is not valid i want it to stay on that frame until the person edits it to be valid. i attached the file and can't figure out why my code is not working.
View 4 RepliesI've created a custom textInput componenet that handles it's own validation using a private validator. The validation is enabled depending on the state of the component i.e. validation is enable when the components state is "edit".However, when the state changes from edit the internal validator is set to not enabled but the validation errors on the textbox do not clear - the textInput still has the red border and on mouseover the validation errors come up. What I want to happen is that when a validator is disabled the error formatting and error messages clear from the text input control.
Does anyone have any idea how to do this I tried setting the internal validator instance to enabled = false and dispatching a new focusOutEvent as below but the validation error formatting is still applied to the textInput contrl.
_validatorInstance.enabled = false;
//clear the validation errors if any
dispatchEvent(new FocusEvent(FocusEvent.FOCUS_OUT));
[code].....
i am not sure if there is a similar thread posted already (i couldn't find one). This is a new class i just put together for a commercial project and i fugured it would be useful for anyone who needs simple email address validation. Its very small (2kb) and appears to be working pretty good. the useage looks like this:
ActionScript Code:
import classes.EmailValidator;
ActionScript Code:
[code].....
I am doing some forms in Flash Cs4 with AS3. The forms are working well, but i have a code to check if people have enter information in every field.But the verification only works for 2 field. The code is exactly the same for the other but it doesn't work. Can you double check my code and maybe explain me why it doesn't work or maybe how to replace the validation code by another.The validation works only for the LastName data and Email field.Here's the code;
submit_btn.addEventListener(MouseEvent.CLICK, ValidateAndSend);
function ValidateAndSend(event:MouseEvent):void{
//validate form fields[code]........
I am doing some forms in Flash Cs4 with AS3. The forms are working well, but i have a code to check if people have enter information in every field. But the verification only works for 2 field. The code is exactly the same for the other but it doesn't work. Can you double check my code and maybe explain me why it doesn't work or maybe how to replace the validation code by another.The validation works only for the LastName data and Email field.Here's the code;
submit_btn.addEventListener(MouseEvent.CLICK, ValidateAndSend);
function ValidateAndSend(event:MouseEvent):void{
//validate form fields[code]................
I have a Flash MX Form that sends data to a MySQL DB. I want to be able to validate the field type on input. When someone enters a phone number and trys to use a text chr I want it to display an error.
View 1 RepliesI have been investigating how to annotate video using Flex or AIR. Similar to how it is being done on YouTube. I am not getting much joy. Wondered if anybody might have any insight?
View 3 RepliesI was wondering if we can put annotation to a video player? like on youtube?
View 3 RepliesLately i discovered MATE (for Flex development) and was wondering: how do i bind a property in a view (actually a navigatorcontent component) to another property in a class so that they stay in synchronization (meaning that whenever the property in the class changes the property in the view also changes).
So if we have a view called Target.mxml and a property targertProp how do we bind it to the class called SourceClass with property SourceProp?
I'm creating something like a video player with annotation functionality. I can load up the notes, with times at which they were made by people (as strings), and put these into an array to be utilized. I also know the current time of the flv video as it's playing.
So each note has a time attached to it, but how can I use these as triggers that fire dynamically in relation to the video's duration?
Is there a commonly used framework for AIR that handles mapping objects to and from the built-in SQLite database? An Annotation-based ORM framework that is to AIR what Hibernate is to Java? Background We have an AIR application that runs offline. I need to save/restore complex objects to/from the SQLite database. Some of these ValueObjects contain references to other ValueObjects. For example, an Order object contains a Customer object which contains an Address object.
Ultimately, I'd like to add metadata to my objects, like an [Entity] tag and have persistence "just work," with minimal configuration. I could roll my own ORM solution, effectively writing "Hibernate for AIR" myself, but SURELY someone has already done this. I've read related posts like Best practices for developing AIR Application with SQLite that advocate creating DAO's, Builders and Services. That's a fine solution but, of course, no one wants to reinvent the wheel if it's not 100% necessary.
[Code]...
If I have three classes:
public class Example {
public function Example () {
}[code]............
You can see that the two last classes extend the first one, and both have the 'variable' property. In case that I have an instance of Example and I am sure it is also an ExtendedExample OR AnotherExtendedExample instance, is there some way to access the 'variable' property? Something like
function functionThatReceivesAnExtendedExample (ex:Example):void {
if(some condition that I may need) {
ex.func()
I have the following inheritance structure:
var environment:AvEnvironment = new AvEnvironment(...);
addChild(environment);
environment.addChild(new Terrain());
environment.addChild(new Player());
I am trying to access a public property from AvEniroments class through the Player class, however I'm getting an undefined property error (#119). I've tried the following:
this.x = AvEnvironment.xs // public property in this class
this.x = parent.xs
I've also tried something like this:
var ev:AvEnvironment = AvEnvironment(parent);
this.x = ev.xs
but I get a TypeError. Error #1009: Cannot access a property or method of a null object reference.
i am using xmllistcollection for displaying data in list. whenever i run my application data is display in list control, but this warning has displayed in console. How can i remove this warning warning: unable to bind to property 'xmlnode' on class 'XML' (class is not an IEventDispatcher)
View 1 Repliessay that i have a base class called Base, that is Bindable and has a String property like this:
[Bindable]
public class Base
{
public var msg:String;
[Code]......
where msg is some textInput field. I am getting a message from the compiler that....
Data binding will not be able to detect assignments to "msg"
is there a limitation with data binding to a base class?
I have a class that looks like this:
[Code]....
now when i try to get the id form the Piece class like this it doesn't work, i've been looking at this for the better part of the past hour! what am i doing wrong?
ActionScript Code:
var player1:Player = new Player("eddie");
player1.setPieces();
trace(player1.pieces[0].id);///why is this not working! getting undefined!
// i tried datacasting i get null
trace(Piece(player1.pieces[0].id));
I was wondering how do you access the stage property from a different class that's not the principal class tied to the fla? Essentially, I have main.as which calls another class menu.as, and I can't seem to be able to use the stage.stageWidth property from menu.as. What's the proper way to be able to use the stage property from any class? Do I have to import it separately each time?
View 2 Repliescan I use the Class datatype to make a class a property, then create new objects from that class? Like so:
class Foo{
private var ExampleClass:Class;
public function Foo(exampleClass:Class){
[Code]....
I have a document class that looks like this:
Code:
package
{
import Map;
[Code]....
Is it possible to access a property of the Map class (though map defined in the Document class) from within the hero class?
The Main.as file will have all of the game logic, such as the mysteryNumber.
The other actionScript files represent rooms that the user may click and depending on the 'mysteryNumber', it will execute the 1 of 6 scenarios.
So for example, if a user clicks the Library page, the LibPage.as will call the 'mysteryNumber' and execute some code to display on the library page.
It will be the same for the other 4 rooms.
The problem I have is that the LibPage.as won't call the 'theNumber' property from Main.as
Here's the Main.as
Code:
package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
[Code]....
In ActionScript 3, there are some classes that will represent a value rather than the class itself. It's hard to explain properly what I mean, so take this example:
[Code]...
I have a question about my xmlReader.as file about XMLReader class.this will be xmlreader class , but i can not take the data.
View 1 RepliesI have a custom class created by a main document class, and I want the custom class to run a function in document class after some time.
How can I sent the instruction from custom class back to the document class?[code]...
I created a movieclip with a star. Then, I creates a document class and I named it as Main.as.
In that document class I wrote:
package
{
import flash.display.*;
public class Main extends MovieClip
[Code]....
I´m not posting here all the code, but you can easily see that I´m using x_origin and y_origin variables to keep the original position of the movie clip. I will use them to move the star back to the original position.
The problem is that instead of being 20 and 30 respectively, tracing them I see that they are both ZERO. So when I drop the star, instead of going to x=20,y=30 it moves back to x=0 and y=0. I´ve to get the star position relative to stage, but I can´t find anyway!
This seems like it should be an easy one but I can't figure it out.I'm trying out a very simple class that, when created, loads and XML file into the class's property. I must be getting a basic concept tangled up here because I can see the XML coming in just fine in the handleComplete function, but the class property _result remains empty.What concept am I missing here?
public class MyClass
{
private var _result;
[code].....
I want to accomplish simply that MC 'Menue' follows MC 'SliderLeftVert_Panel'. I don't get it.I get this error: TypeError: Error #1009: Cannot access a property or method of a null object reference at SliderSlide/Move()
The MC 'SliderLeftVert_Panel' is linked to Class 'SliderSlide.as' below
package {
import flash.display.*;
import flash.events.*;[code]...........
I want to accomplish simply that MC 'Menue' follows MC 'SliderLeftVert_Panel'. I don't get it.
I just caunt figure out how to get out a specific property on a response..for example my listner is
Code:
socketConnection.socket.addEventListener(DataEvent.DATA, recievedHelloBack);
my function is
[code].......