Alert.show("Do you want to remove all the events", "Confirmation",
Alert.OK | Alert.CANCEL, this,
confirmRemove, null, Alert.OK);
private function confirmRemove(evntObj:CloseEvent):void
{
if (evntObj.detail==Alert.OK) {
//Add the code to execute if use pressed OK button
}
}
Flex action scripting, Zend AMF , Audio/Video Player, IBM ILOG Calendar, Cairngorm Framework
Convert Flex date timestamp to UTC timestamp
var localDate:Date = new Date();
var localTimestamp:Number = localDate.valueOf() / 1000;
//date with valueOf function returns the milliseconds and divide by 1000 to convert to seconds
var timzoneOffset:Number = localDate.timezoneOffset * 60;
//Timezone offset returns the minutes and multiply by 60 to convert to seconds to use for timestamp
var utcTimestamp = localTimestamp + timzoneOffset;
var localTimestamp:Number = localDate.valueOf() / 1000;
//date with valueOf function returns the milliseconds and divide by 1000 to convert to seconds
var timzoneOffset:Number = localDate.timezoneOffset * 60;
//Timezone offset returns the minutes and multiply by 60 to convert to seconds to use for timestamp
var utcTimestamp = localTimestamp + timzoneOffset;
Adding Timer Event Listener
For adding or handling the time based functions we can use flex Timer Util class.
import flash.events.TimerEvent;
import flash.utils.Timer;
private var timer:Timer;
private function init():void
{
timer = new Timer(10);
timer.start();
timer.addEventListener(TimerEvent.TIMER, checkDbChange);
}
private function checkDbChange(t:TimerEvent):void
{
trace("Database updated");
}
import flash.events.TimerEvent;
import flash.utils.Timer;
private var timer:Timer;
private function init():void
{
timer = new Timer(10);
timer.start();
timer.addEventListener(TimerEvent.TIMER, checkDbChange);
}
private function checkDbChange(t:TimerEvent):void
{
trace("Database updated");
}
File not found in bin-debug/*.html
It happens while we import the project. To solve the issue you can try the following way
1. Project->Build Automatically then try
2. Project->Clean the selected project then try
If the above procedure doesn't work try the following.
3. Project->Properties->Compiler Settings
Check HTML Wrapper and If Not checked checked and try.
If the HTml Wrapper is checked the un-check then save then try to run it again.It will not work then again check the HTML Wrapper and try. I got it solved the issue.
1. Project->Build Automatically then try
2. Project->Clean the selected project then try
If the above procedure doesn't work try the following.
3. Project->Properties->Compiler Settings
Check HTML Wrapper and If Not checked checked and try.
If the HTml Wrapper is checked the un-check then save then try to run it again.It will not work then again check the HTML Wrapper and try. I got it solved the issue.
Error Cannot convert XMLList@5967b21 to Date
To convert XMLList date to date, first convert it to String then the date string into Milliseconds using the Date.parse method. Then you can convert the seconds to Date object
Ex: var dateString:String = xmlDateValue.toString();
var dateInMilliseconds:Number = Date.parse(dateString);
//date format "Wed May 4 15:30:17 GMT-0700 2011"
var curDate:Date = Date(dateInMilliseconds);
Ex: var dateString:String = xmlDateValue.toString();
var dateInMilliseconds:Number = Date.parse(dateString);
//date format "Wed May 4 15:30:17 GMT-0700 2011"
var curDate:Date = Date(dateInMilliseconds);
Convert String to Date
To convert string to date, first convert the date string into Milliseconds using the Date.parse method. Then you can convert the seconds to Date object
Ex: var dateInMilliseconds:Number = Date.parse("Wed May 4 15:30:17 GMT-0700 2011");
var curDate:Date = Date(dateInMilliseconds);
Ex: var dateInMilliseconds:Number = Date.parse("Wed May 4 15:30:17 GMT-0700 2011");
var curDate:Date = Date(dateInMilliseconds);
Convert String into Array
We can convert the String into Array with splitting it with delimiter.
Ex:
var sampleString:String = "Hello World";
var results:Array = excDate.split(" ");
Ex:
var sampleString:String = "Hello World";
var results:Array = excDate.split(" ");
Subscribe to:
Posts (Atom)