News.Flash MX: Screenweaver MX Beta 3 is released.
The current Flash player is primarily used to display Flash content that was initially created for the web. Screenweaver is an extension to the Flash player that aims at providing Flash developers with a toolset to produce rich media desktop applications. By doing so it enables the developer to apply their existing skill set to new uses of Flash technology.
Screenweaver enables the Flash MX, C++, VB, Delphi or C# programmer to create Win32 desktop applications that utilize Flash content as interface.
Now beta 3 is available for download which is fully functional except that it will expire on December 7th. Visit their website for more details
posted by Arul
| link
| ^top
| next> |
comments [4]
Monday, November 25, 2002
Tips.Director: Enabling Flash Links in Director.
It's time for Director again (time for Director MX in fact!). Somebody sent me a mail asking why the getURL functions which are supposed to open the links are failing when we embed the flash movie in director?
The reason is simple, both getURL and FSCommand are methods for flash to communicate to the container application. When we embed the flash file in a HTML page Flash plugin for the Browser is the container which receives and executes this commands. But when we embed the swf in Director, it becomes the container which doesn't know how to handle the requests. That's why it fails, we can write the following lingo as a moviescript to solve the problem.
on getURL(me,url,target)
gotoNetPage url,target
end
Then the next problem is your flash buttons will not change the cursor. Use the following lingo as a behavior attached to the flash sprites for the rescue
on mouseWithin me
if sprite(the currentSpriteNum).hitTest(the mouseLoc) = #button then
cursor 280
else
cursor -1
end if
end
News.Flash MX: Server Side ActionScript in ColdFusion MX vs JRun.
Both JRun and ColdFusion MX support Server Side ActionScript, but there is a difference.
In ColdFusion there is an Object called CF with two exposed methods query and http. Using CF.query we can retrieve data from the database by executing SQL query.
There is no such object in JRun. :(
I came to know about this when I was trying to port my server side actionscript file (.asr) from ColdFusion MX to JRun.
News.Flash MX: Yet Another Action Script Highlighter.
Cyberfunk (Flash-tools) has come out with his own actionscript highlighter in Perl.
He calls it PASH (Perl Action Script Highlighter) and it is also available for download. You can read more on his site.
posted by Arul
| link
|<prev. | ^top
| next> |
add comment
Sunday, November 17, 2002
Bug.Flash MX: DRK Message Board Data Grid Sample Errata.
Creating a custom cell symbol for datagrid is very easy. Every cell gets a function, setValue and setSize. When the grid is built, resized or value is changed, these functions will be called.
Message Board is a datagrid sample application that comes with the The Macromedia MX Developer Resource Kit in which you can send and receive message like a email application.
In that sample they have created a custom cell symbol for showing indicating new messages. The following code is used for building the custom cell component
#initclip 2
/* IsNewCellClass
Don't panic, this is quite easy. Every cell gets a function,
setLabel (also setSize, but not covered here). In our case,
setLabel checks for the "X" and displays if it's there.
*/
function IsNewCellClass()
{
this.check._visible = false;
}
Object.registerClass("IsNewCell", IsNewCellClass);
IsNewCellClass.prototype = new MovieClip();
IsNewCellClass.prototype.setLabel = function(obj)
{
this.check._visible = (obj=="X");
}
#endinitclip
Here setValue function is wrongly mentioned as setLabel function. Find and replace 'setLabel' with 'setValue' to make it work.
posted by Arul
| link
|<prev. | ^top
| next> |
comments [1]
Wednesday, November 13, 2002
Examples.Flash MX: Creating Dynamic Chart with Flash Charting Components.
Here is the dynamic chart example from my Singapore User group Seminar.
Steps:
Create a text file with the following text and name it chartData1.txt. I'm using &name= value& syntax instead of usual name1=value1&name2=value2 for better readability (LoadVars will ignore the extra '&' and the line brakes)
&label=Singapore,US,India&
&value=1240,780,360&
&dataName=Page Views&
&ChartTitle=Stats for Arul's Blog&
&XAxisTitle=Country of origin&
&YAxisTitle=Number of Visits&
Drag and drop a Pie Chart component, name it myPieChart and increase the span to 2 frames in the time line
Add another layer on top and create a shape in the same color as the chart to hide it in the first frame (It will hide the chart until the dynamic chart data is loaded)
Add a static text in the same layer as the shape and type "Loading Chart Data..." to show while loading
Add another frame, name it actions and copy & paste the following code
//Keep it in the first frame until chartData is loaded
stop();
_global.chartLoader = new LoadVars();
chartLoader.chartData = new DataProviderClass();
chartLoader.onLoad = parseChartData;
chartLoader.load("chartData1.txt");
function parseChartData(loadSuccess) {
if (loadSuccess) {
with (chartLoader) {
label = label.split(",");
value = value.split(",");
for (var i = 0; i<label.length; i++) {
var item = {value:(Number(value[i]))};
item[dataName] = label[i];
chartData.addItem(item);
}
}
}
//applyChartData(myLineChart);
//applyChartData(myBarChart);
applyChartData(myPieChart);
//Now go to frame 2 to show the chart
gotoAndStop(2);
}
function applyChartData(Chart) {
with (Chart) {
setDataProvider(chartLoader.chartData);
setLabelSource(chartLoader.dataName);
setChartTitle(chartLoader.ChartTitle);
setXAxisTitle(chartLoader.XAxisTitle);
setYAxisTitle(chartLoader.YAxisTitle);
}
}
It will result in the following graph
Once it is up and running you can dynamically generate the data using server side scripting instead of static text file.
Finally I received the Macromedia MX Developer Resource Kit today!
I'm right now playing with the DataGrid component.
The following example is just to show how simple it is to use the data grid component. I've created it by
dragging and dropping a data grid component and naming it as my_dg.
adding a dynamic text box and naming it as my_txt
adding the following actionscript in frame 1.
my_dg.setColumns("Name", "Purity");
my_data = [
{
Name:"Arul", Purity:90,
Description:"very much human"
},
{
Name:"GOD", Purity:100,
Description:"the perfect, omnipotent, omniscient originator and ruler of the universe"
}
];
my_dg.setDataProvider(my_data);
my_dg.setChangeHandler("dgChange");
function dgChange() {
var sel = my_dg.getSelectedItem();
my_txt.text = sel.Name+" is "+sel.Description+". He is "+sel.Purity+"% pure";
}
Thanks to all my well wishers. Now I'm alright and back to work. I will start posting the seminar examples one by one as and when I find time. (I have to cleanup the code before doing it)
posted by Arul
| link
|<prev. | ^top
| next> |
add comment
Thursday, November 07, 2002
Update.Arul's Blog: Not Feeling Well.
Last Saturday suddenly I've fainted and after that I had little blurred vision for 2 days and having head ache till now. :(
I didn't take it seriously, but my family forced me to take a medical test. So I've undergone the tests including X-ray. I've been told to take rest for 2 days. With the given tablets I should be alright otherwise I need to under go other tests.
Yesterday after finishing the change case ActionScript for flash, I thought why not to port it as an extension for dreamweaver?
Because Dreamweaver supports javascript for extensibility which is also an ECMA script like ActionScript.
After some search, I found an article written by Bob Berry on "Creating a simple Commands extension for Dreamweaver" in which he expanined how to create change case command which can convert strings to either uppercase or lowercase.
Also Hawa Edelstein already created an extension for the same.
Based on these two codes and my "Title Case", "Sentense Case" and "Toggle Case" code, I've come up with this extension which can change the case of selected text to one of the following,
Sentence case - Capitalizes the first letter of the word in the selected sentences.
Lowercase - Changes all selected text to lowercase letters.
Uppercase - Changes all selected text to capital letters.
Title Case - Capitalizes the first letter of each word in the selection
tOGGLE cASE - Changes all uppercase letters to lowercase in the selection and vice versa.
You can download and try it your self from here. It is still a BETA version only, if you find any bugs please post it in the comments.
posted by Arul
| link
|<prev. | ^top
| next> |
comments [6]
ActionScript Standard Library project is really picking up. For those who are hearing it for the first time, the ActionScript Standard Library is a collection of ActionScript classes and libraries that aims to create and provide a standard library of functionality to ActionScript. ASL is an Open Source initiative by Mike Chambers, the community manager of macromedia.
Currently 33 developers (including me) started putting in their efforts. If you want to get updated with the latest development about that project you can visit the forum and/or subscribe to the mailing list.
We are going to start with extending String, Date, Math Objects and then proceed to other complex Objects.
Here are some of my ideas to extend the String object.
Title Case:
String.prototype.toTitleCase = function() {
var str = "";
var prevWhite = true;
for (var i = 0; i<this.length; i++) {
str += prevWhite ? this.charAt(i).toUpperCase() : this.charAt(i).toLowerCase();
prevWhite = this.charCodeAt(i)<=32;
}
return str;
};
Example:
trace("message to the universe of girls: i'm having a mechanical life here :(".toTitleCase());
//outputs 'Message To The Universe Of Girls: I'm Having A Mechanical Life Here :('
Sentence case:
String.prototype.toSentenceCase = function() {
var str = "";
var SentenceBrake = true;
for (var i = 0; i<this.length; i++) {
str += SentenceBrake ? this.charAt(i).toUpperCase() : this.charAt(i).toLowerCase();
SentenceBrake = (SentenceBrake && this.charCodeAt(i)<=32) || "\r\n.,?:;!".indexOf(this.charAt(i)) != -1;
}
return str;
};
Example:
trace("i'm searching for my soul mate. if you feel you are the one (at least try to feel like that)".toSentenceCase());
// outputs 'I'm searching for my soul mate. If you feel you are the one (at least try to feel like that)'
tOGGLE cASE:
String.prototype.toToggleCase = function() {
var str = "";
for (var i = 0; i<this.length; i++) {
str += this.charCodeAt(i)<=90 ? this.charAt(i).toLowerCase() : this.charAt(i).toUpperCase();
}
return str;
};
Example:
trace("i'M wAITING fOR yOU, dO dROP mE a mAIL".toToggleCase());
//outputs 'I'm Waiting For You, Do Drop Me A Mail'
Single Space: - Clears the extra spaces and line brakes in the given String
String.prototype.toSingleSpace = function() {
var str = "";
var prevWhite = true;
for (var i = 0; i<this.length; i++) {
var code = this.charCodeAt(i);
white = code<=32;
if (white) {
if (!prevWhite && (code == 9 || code == 32)) {
str += " ";
}
} else {
str += this.charAt(i);
}
prevWhite = white;
}
return str;
};
Example:
trace("I have waited for you so \rl o n g \n !".toSingleSpace());
//outputs 'I have waited for you so l o n g !'
//note:-
// the text used in the examples is just for fun,
// should not be taken seriously [except by the willing girl(s!?)]