JavaScript function to travel to a WEB Page : redirect()

January 31, 2008

In flex we use navigateToUrl () method to traverse to a WEB page, usually with a link Button or Button.

So how to do this with Javascript code behind the flex App, the solution is simple with a line a code.

The line is :

window.location.href=””;

specify the link in the double quotes.

Example:

In flex iam having Button which calls the function redirect() at JS,which contains the line of code, then definition would be as below..,

Code at Flex app:

<mx:Button id=”btn” click=”b()”/>

<script>

private function b():void

{

ExternalInterface.call(“redirect”);

}

</script>

Code at JS/html wrapper:

<script language=”javascript”>

function redirect()

{

 window.location.href=”http://www.google.com/&#8221;

}

</script>

Now on click Button the page will travel to the Google Page.


Description of Basic elements of a Flex application.

January 29, 2008

Flex framework

The Adobe® Flex 2 framework contains all the components you need to
build rich Internet applications, which include:
-Containers that you use to layout the application
-Controls you use to gather data from users and to manage the user interface (Text and Button, for example)
-Extensive data binding, formatting, and validation features
-An event-driven development model that provides rich user interface transformation features such as effects and transitions
-The Flex framework is contained within a shared component library (SWC) file.

MXML

Every Flex application contains at least one MXML file,
known as the main application file. MXML is a markup language,
an implementation of XML that was designed specifically for creating Flex
applications, and you use it to declaratively define the structure of your
application using tags.

ActionScript 3.0

You add dynamic behavior to your applications using ActionScript 3.0,
which is an implementation of ECMAScript and is similar to JavaScript.
You can add ActionScript to Flex applications directly in the MXML file as
script blocks or you can create separate files of ActionScript functions and
import them into your MXML files.

CSS

Style attributes in visual components (buttons, list boxes, and so on) are
controlled by component properties. For example, a button component has a
fontFamily property that you use to set the font. Style properties are controlled
by a theme, by styles defined in a CSS file, by styles defined in style blocks in an
MXML file, or by setting individual style properties in the component instance itself.

Graphic assets

Like most applications, Flex applications contain a variety of graphic assets such as
icons and other images.

Data

Some components are used to display data (a combo box or data grid for example)
and you can populate these components with data by using arrays, collection objects,
data models, external XML data sources, and so on.


Basic Elements of a Flex Application.

January 28, 2008

A typical Flex application consists of the following elements.

  • Flex framework
  • MXML
  • ActionScript 3.0
  • CSS
  • Graphic assets
  • Data

i will Come back with description .keep in touch.bye


Smoothing the resizing of layout’s in flex with effects.

January 25, 2008

For example suppose that there is an App where you wanted a Panel control to resize on click of button, then u would probably use setting the width and height of the panel.Which will resize the Layout, but the resize is not smooth [i.e immediate movement in resize] ,so we have to slow down the resize so that it looks fine [smooth].

So here we have to use a tag called <mx:Resize /> to achieve this.

Example :

<mx:Resize duration=”2000″ id=”r1″/>

Now this resize Effect can be included with any layouts.

Here iam using a Canvas, below one shows it.,

<mx:Canvas id=”cnv” width=”50%” height=”100%” resizeEffect=”r1″>
<mx:Panel layout=”absolute” id=”p” height=”100%” width=”100%”>
<mx:ControlBar horizontalAlign=”center”>
<mx:Button label=”FullScreen” click=”fullscreen()” id=”f”/>
<mx:Button label=”Compact” click=”compact()” id=”c”/>
</mx:ControlBar>
</mx:Panel>
</mx:Canvas>

Here resizeEffect is the property iam using [in canvas] to specify the resize effect to the canvas.

And the functions are here which will move the canvas. to full screen.,

<mx:Script>
<![CDATA[
import mx.effects.easing.*;
import mx.controls.Alert;
private function fullscreen():void
{
cnv.width=this.screen.width-100;
}
private function compact():void
{
cnv.width=(this.width)/2.2;
}

]]>
</mx:Script>

So atlast the the resize of canvas is smoothen by using resize effect..using <mx:Resize /> Tag and resizeEffect Property. simple and small but very use full.


Good PHP tutorials at my blog.

January 25, 2008

Even though the help file at php has many good examples and explanations ,some of the users still search the web for php tutorials ,so for them i give the tutorials which were prepared by me and my team members ,and these are really good ones, its brief and quick.

Basics/Musics of PHP..

“fun”ctions and “class”es in PHP

strings Part1 PHP

strings Part2 PHP

URL functions PHP

click the above links to navigate and download..


Writing secure Flex applications.

January 24, 2008

The below ppt shows the things to do.. follow them for secure flex app.

flex-security.ppt [click this to view]

  • ¬MXML tags with security restrictions
  • ¬Disabling viewSourceURL
  • ¬Remove sensitive information from SWF files
  • ¬Input validation
  • ¬ActionScript
  • ¬Using passwords.

These were the topics covered in this ppt [tutorials]very use full.


Another solution for cache problem in IE.

January 24, 2008
This solution was given by the member of the Google group ,so i think i should keep this in my blog for future reference for me and for every flex lover.So the lines are here..In IE

1) Go to internet options.

2) Temporary Internet Files >  Settings > Check for new versions ofstored pages >  Select Radio : “Every Visit to the server”then check your application.

It should work, and gets the new data. Itis the problem with Cache.This problem generally arises in AJAX also. Then we can’t expect everyuser to workaround these settings.

So add this header to the server side page.

———————-”Cache-Control: no-cache, must-revalidate”———————-

For example, in php

<?phpheader(”Cache-Control: no-cache, must-revalidate”);?>

This is the Permanent solution to cache.. comparing to the previous post


Follow

Get every new post delivered to your Inbox.