Using ActionScript 3.0 it is difficult not
to get confused, which one to choose out of
XML or XMLNode or XMLDocument class.
Answer is XML.
XMLNode and XMLDocument exist only for the
sake of backward compatibility.
Thursday, July 24, 2008
Friday, July 18, 2008
Google Account Authentication - flex example
This example works for normal gmail accounts as well
as hosted accounts for e.g. kyz@some_domain_hosted_at_google.com.
as hosted accounts for e.g. kyz@some_domain_hosted_at_google.com.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="onAppInit()">
<mx:HTTPService id="requestClips"
url="https://www.google.com/accounts/ClientLogin"
result="handleHttpResponse(event)" method="POST" fault="handleFault()"/>
<mx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
private function onAppInit()
{
// "accountType=&Email=".$uname."&Passwd=".$password."&
//source=Movico-MediaBaron-2.0";
var params:Object = {};
//requestClips.url = "http://localhost/MPC/check.php";
params["accountType"] = "HOSTED_OR_GOOGLE";
params["Email"] = "";//for e.g. abc@gmail.com
params["Passwd"] = "";//you know it.
params["source"] = "Company-App-version";
requestClips.send(params);
}
import mx.controls.Alert;
private function handleFault()
{
Alert.show("Either your username/password is incorrect or Google is down");
}
private function handleHttpResponse(event:ResultEvent)
{
var check:String = event.result.toString();
console.text = check;
Alert.show("Authentication Successful !");
}
]]>
</mx:Script>
<mx:TextArea id="console" width="100%" height="100%"/>
</mx:Application>
Thursday, July 10, 2008
Adobe Flex tileList not getting refreshed
Recently I ran into a very tough problem.
I was using a tileList with a dataProvider,
but it wasn't getting refreshed even when
the dataProvider changed.
Complete description and solution is available
here . On this page, you will see a message
by Experts Exchange that the solution is
available only to premium members,
but if you scroll down, the solution
is actually displayed there.
Thanks to Dolly Sapra for the solution,
and saving hell lot of my time !
I was using a tileList with a dataProvider,
but it wasn't getting refreshed even when
the dataProvider changed.
Complete description and solution is available
here . On this page, you will see a message
by Experts Exchange that the solution is
available only to premium members,
but if you scroll down, the solution
is actually displayed there.
Thanks to Dolly Sapra for the solution,
and saving hell lot of my time !
Tuesday, July 8, 2008
Extracting the subtitles from a srt file using Vim
Here is a sample snippet from a srt file(subtitles for Himalaya)
1
00:02:35,600 --> 00:02:37,900
Grandfather.
2
00:02:40,800 --> 00:02:44,500
This is for my family.
3
00:02:44,500 --> 00:02:47,600
An excellent harvest, Tsering.
4
00:02:49,200 --> 00:02:55,900
How long do you think it
will feed us?
5
00:02:55,900 --> 00:02:58,600
A very long time.
Now, I want to remove the numbers 1,2,3,4,5 etc. as well as the time
information using vim.
It's damn easy.
Step 1 :
:g/-->/d (remove all the lines matching -->)
Step 2:
:g/^\s*$/d (remove all the lines containing only white spaces)
Step 3:
:g/^[0-9]\s*$/d (remove all the lines containing only numbers - this might
delete some useful stuff too, but anyway).
that's it.
1
00:02:35,600 --> 00:02:37,900
Grandfather.
2
00:02:40,800 --> 00:02:44,500
This is for my family.
3
00:02:44,500 --> 00:02:47,600
An excellent harvest, Tsering.
4
00:02:49,200 --> 00:02:55,900
How long do you think it
will feed us?
5
00:02:55,900 --> 00:02:58,600
A very long time.
Now, I want to remove the numbers 1,2,3,4,5 etc. as well as the time
information using vim.
It's damn easy.
Step 1 :
:g/-->/d (remove all the lines matching -->)
Step 2:
:g/^\s*$/d (remove all the lines containing only white spaces)
Step 3:
:g/^[0-9]\s*$/d (remove all the lines containing only numbers - this might
delete some useful stuff too, but anyway).
that's it.
Monday, July 7, 2008
Flex : Accessing attributes in XML data passed as ArrayCollection
Suppose this is the XML data you get as
in response to your HTTService :
And then, you use the result as the dataprovider
of your datarenderer :
photoFeed = event.result.catalog.clip as ArrayCollection;
Then inside you data renderer, if you want to access the
attributes of a CLIP
node, you have to do this :
t.text = data["desc"];
in response to your HTTService :
<?xml version="1.0"?>
<catalog desc="desc3">
<clip desc="desc1">
<title>check</title>
</clip>
<clip desc="desc2">
<title>check2</title>
</clip>
</catalog>
And then, you use the result as the dataprovider
of your datarenderer :
photoFeed = event.result.catalog.clip as ArrayCollection;
Then inside you data renderer, if you want to access the
attributes of a CLIP
node, you have to do this :
t.text = data["desc"];
Wednesday, July 2, 2008
flex reading data from XML url
This is how the Config.xml looks like:
<?xml version="1.0" ?>
<config channelName="zee" bgColor="0xcc0066"
gridNumRows="3" gridNumCols="3" />
This example shows how to read the attributes of
an XML node.
<mx:HTTPService id="readConfig"
url="Config.xml" resultFormat="xml"
result="showClips(event)"/>
<mx:script>
<![CDATA[
import mx.rpc.events.ResultEvent;
[Bindable]
[Bindable]
private var configParams:XML;
private function showClips(event:ResultEvent):void {
configParams = (XML)(event.result);
mainGrid.rowCount = (int)((int)(configParams.@gridNumRows)-(int)('0'));
mainGrid.columnCount = (int)((int)(configParams.@gridNumCols)-(int)('0'));
cnLabel.text = configParams.@channelName;
}
Tuesday, July 1, 2008
ffmpeg with h264
1. I built ffmpeg myself with x264, but it doesn't work properly.
May be I should try with Mingw in place of Cygwin.
2. I analyzed SUPER. It uses ffmpeg, which is not built with h264 support. But SUPER
can still encode files with h264, since it uses x264.exe separately. I wanted to know
the exact commands, so I replaced their ffmpeg with my ffmpeg, but SUPER didn't
even launch.
3. If you are not too keen on building ffmpeg yourself,
simply pick it from here. It works with -vcodec h264.
The latest version available here seems to be problematic.
May be I should try with Mingw in place of Cygwin.
2. I analyzed SUPER. It uses ffmpeg, which is not built with h264 support. But SUPER
can still encode files with h264, since it uses x264.exe separately. I wanted to know
the exact commands, so I replaced their ffmpeg with my ffmpeg, but SUPER didn't
even launch.
3. If you are not too keen on building ffmpeg yourself,
simply pick it from here. It works with -vcodec h264.
The latest version available here seems to be problematic.
Subscribe to:
Posts (Atom)