Archive for the Flash category

New training for technical artists using Flash and Maya.

posted by Marcio Rosa in Flash, Maya, Papervision3D

Learn an innovative workflow to exporting, rendering and publishing data and creative techniques for seamlessly integrating Flash and Maya for presenting 3D assets and animations on the web. Contains over 2.5 hours of project-based training for technical artists using Flash and Maya. 

Popular highlights include: 

Review of Flash Application 
Review of Maya Application 
Creating 3D Turntables 
ActionScript 1.0 & 3.0 
Using Maya Vector Renderer 
Working with Fills and Edges 
Rendering Wireframes 
Shadows, Reflections and Highlights 
Alternate Edge Workflow 
Working with Multiple Frames 
Repeated Tracing with Flash JavaScript 
Using Papervision 3D 
Export Collada Files for Papervision 3D 
Updating Builds with SVN 
Coding 3D Actions 
Various Tips and Tricks

First in Brazil. By Marcio Rosa

SWFObject 2.1

posted by Marcio Rosa in Flash, Javascript

The first update of SWFObject 2 has arrived. SWFObject 2.1 includes a series of fixes and enhancements. It’s good, go get it!

The Adobe Flash for digital interaction

posted by Marcio Rosa in AIR, AS 3.0, Flash

IMAGINE

We imagine a world where every digital interaction whether in the classroom, the office, the living room, the airport, or the car is a powerful, simple, efficient, and engaging experience. Flash Player is widely used to deliver these experiences and has evolved into a sophisticated platform across browsers, operating systems, and devices.

We continued to invest in building a range of technologies and prepared for the day that innovation on the web would ignite again. The days of innovation have now returned in full force, and I am delighted to see rich Internet applications coming into their own with Web 2.0.

THE AIR

The AIR project is actually our third attempt at creating this new environment. The first two attempts were part of an experimental project called Central which was code named Mercury and then Gemini after the United States space program, and with AIR code named Apollo. We learned a lot from those first two projects, and as I like to remind the team, Apollo is the one that actually went to the moon.

With AIR, you can leverage your existing web development skills (Flash, Flex, HTML, JavaScript, Ajax) to build and deploy RIAs to the desktop. Just like web publishing allowed anyone with basic HTML skills to create a web site, AIR will enable anyone with basic web development skills to create a desktop application.

As a developer, you can now create a closer connection to your users. With the browser, you have a fleeting, somewhat tenuous, connection to users. They browse to a page, and then they’re gone. AIR enables you to create an experience that can keep you continuously connected to your customers. Just like a desktop application, AIR applications have an icon on the desktop, in the Windows start menu, or in the OS X dock. Also, when you’re running a web application today, it’s a separate world from your computer. You can’t easily integrate local data with your web application. For example, you can’t just drag and drop your Outlook contacts onto a web-based mapping application to get directions to your friend’s house. Yet with AIR applications you can, as it bridges the chasm between your computer and the Internet.

AS3

0 ActionScript is the official programming language of Adobe’s Flash platform. While originally conceived as a simple tool for controlling animation, ActionScript has since evolved into a sophisticated programming language for creating content and applications for the Web, mobile devices, and desktop computers. True to its roots, ActionScript can be used in many different ways by many different kinds of programmers and content producers. For example, an animator might use just a few lines of ActionScript to pause the playback of a web animation. Or, an interface designer might use a few hundred lines of ActionScript to add interactivity to a mobile phone interface. Or, an application developer might use thousands of lines of ActionScript to create an entire email-reading application for web browser and desktop deployment.

ActionScript 3.0 is an object-oriented language for creating applications and scripted multimedia content for playback in Flash client runtimes (such as Flash Player and Adobe AIR). With a syntaxreminiscent of Java and C#, ActionScript’s core language should be familiar to experienced programmers.

Papervision3D and Adobe Flex

posted by Marcio Rosa in Flash, Papervision3D

Representing exact geographic locations on the earth, or geocoding, has become a popular topic lately. All the mapping service providers, such as Google, MapQuest, and Yahoo!, geocode addresses on their respective maps so you can easily see a specific location and get directions between multiple locations. With each of these services now providing public APIs, anyone can create mashups showcasing data of all types (such as photos, videos, and RSS feeds) on maps to link the data visually to a geographic location.

Allowing people to so easily associate data geographically has opened up new realms of information visualization on the web. RSS feeds not only provide news from around the world, but they can also display exactly where the news is coming from. Family and friends can follow along with you on your vacation as you post pictures and tag them with each city you visit. Geocoding opens up all kinds of possibilities.

Plotting the points in 2D on the maps provided by the different service providers is the most common way to view the information. But you can also view geodata on a globe of the earth in 3D via Adobe Flash by using the open-source 3D library Papervision3D.

Papervision3D is an open-source, real-time 3D engine for Flash. Using this library, you can get up to speed quickly and easily with a fully interactive 3D environment.

In this article, I show you how to use Papervision3D and the mapping API from Yahoo! and then combine them to display any location you enter on a 3D globe of the world.

Anxious to see what we’re going to create? You can view the end result here.

Setup

First download the sample files (geoglobe.zip, 360 KB) so you can follow along and compare your code. Next, download the required libraries. You can download Papervision3D from Google Code. The current featured release is 1.5, but the beta of 2.0 is available in the Subversion (SVN) repository. For this article, we are using the beta (or GreatWhite as the Papervision3D team has coined it). We will also need the Tweener library to handle the rotations of the globe (use the "as3" directory as the source for the Tweener library).

Note: To learn more about Subversion, check out Subversive or Subclipse. Both are Eclipse plug-ins that can be used with Adobe Flex Builder to help you work with SVN more easily. I have always used Subclipse, but I recently found out that Subversive was migrated under the Eclipse umbrella and seems to be the SVN client of choice for Eclipse.

Once you’ve checked out the repositories as Flex library projects into Flex Builder, create a new Flex project and call it GeoGlobe. Now add the two previous libraries to the library path of the GeoGlobe project. To do this, right-click the GeoGlobe project and select Properties. Navigate to Flex Build Path and select the Library Path tab. Then click the Add Project button and select both libraries. Now you’re ready to go.

Creating the heavens and the earth

Actually we’ll just create the earth. I’ll leave the heavens to you.

To get started with Papervision3D, you need to set up several things. First, you need to create a renderer, along with a scene, a camera, and a viewport. In the past, this was a repetitious, time-consuming task, but with the beta release, the Papervision3D team has created a BasicView class that sets everything up for you. All you need to do to get started is extend this class and start adding your own 3D geometry.

Let’s create a GlobeView class that extends org.papervision3d.view.BasicView. This class will handle the creation of the globe and the markers to represent geographic locations.

The globe is the more important of the two. Create a new class and set it to extend org.papervision3d.objects.primitives.Sphere. All you need to do in this class is give the sphere a radius, segments, and a material. Set the radius to 320, the width segments to 24, and the height segments to 20. The more segments you give the sphere, the smoother the sphere will be. However, the more segments you give the sphere, the more the processor has to work. You need to balance the two, depending on the application you are creating.

The last property to set up is the material for the sphere. To accurately plot the latitude and longitude later, and to avoid distortion, you need a Mercator projection of the world. Mercator projections are cylindrical map projections that can be seamlessly wrapped around a sphere. The downloadable source files for this article contain one Mercator map. Feel free to find and try others to give the earth different appearances.

Now let’s create the Marker class. The marker represents each geographic location on the map. I have created a simple cube as the marker, but you can create any type of 3D object to represent your marker. The Marker class extends org.papervision3d.objects.DisplayObject3D. The Marker class is actually a container of another 3D object; it does not extend the actual 3D object. This enables us to move the object up in the z direction within the container and then place the object based on the container’s axis, which enables the object to sit above the surface of the globe rather than in the middle of it. Again, feel free to replace the marker object with any 3D object you want, but for now we’ll use a cube.

For the GlobeView class, you need to create the globe and initialize the camera:

//Create a null object for the camera to copy.
cameraTarget = new DisplayObject3D();
scene.addChild( cameraTarget );
 
//Rotate the camera target to have the camera face America.
cameraTarget.yaw( 180 );
 
//Create the globe.
globe = new Globe();
scene.addChild( globe );
 
//Set the camera's focus and zoom.
camera.focus = 1100;
camera.zoom = 1;

Here we set the focus and zoom of the camera and created a target for the camera. The target, which is just an empty 3D display object, is used as a pseudo axis for the camera to rotate around. Papervision3D enables you to copy the position and transform settings of any 3D object and use them as the position and transform settings of any other 3D object. To do that, set the camera’s transform setting to the target’s transform setting and then move the camera backward a certain distance each time the scene is rendered. We move it back so that the camera is still far enough away from the globe to actually view it. If you didn’t do that, the camera would be inside the globe along with the target.

Now let’s set up the main Flex project application, GeoGlobe.mxml. Add a script tag and an event handler that listens for creationComplete. In the creationComplete handler, you want to create an instance of the GlobeView. You also need to set up an input text field and two buttons. The text field will expect a geographic location, and the two buttons add a marker to the globe at the specified location and clear the markers from the globe respectively.

Latitude and longitude

We need a way to retrieve latitude and longitude points of any geographic location that is entered into the text field so we can accurately plot the locations on the globe. Luckily, this is a simple process with the help of one of the map services’ APIs.

Google, MapQuest, and Yahoo! each provide an API for geocoding. I’ve chosen Yahoo! because they provide a direct URL that you can pass a free text location to and retrieve latitude and longitude values back. The location can be a city, state, city and state, country, or ZIP code. Once you hit the URL, you get back an XML file with details of that particular location. Two of the nodes list latitude and longitude.

To take advantage of this URL, you need to register with Yahoo! and get an application ID. The URL requires two query parameters: the location you would like to geocode and an appID.

Note: Once you get your Yahoo! application ID, make sure to enter it into the Geocoder class in the source code.

Plotting points

Retrieving the latitude and longitude of geographic locations is the easy part. Plotting them in the correct location can be tricky.

Let’s look at what we have and what we will need to accomplish this task. We have a 3D sphere that has been mapped with a Mercator projection of the earth. We also have latitude and longitude points of any location on earth. What we need is an algorithm for converting these geographic locations to x, y, and z points on the globe.

Luckily, this algorithm already exists. The algorithm converts spherical coordinates to Cartesian coordinates:

1
2
3
x = r sin θ cos φ
y = r sin θ sin φ
z = r cos θ

where r is the radius; θ is theta, or the latitude; and φ is phi, or the longitude.

You don’t need to be overly concerned with why or how the math works, just know that it does. What you do need to be aware of is that y and z will actually need to be swapped in the algorithm because the algorithm assumes z is in one direction while Papervision3D assumes it is in a different direction. The only other thing to be aware of is that you might need to offset the latitude and longitude by a certain number of degrees, depending on the placement of the map on the globe. Ours will need to have the latitude shifted 90 degrees and the longitude shifted 15 degrees.

Like I said, the math is the tricky part, but if you can get past that and accept that it works, you’ll be much happier.

Putting it all together

So now all you need to do is capture the text input from the text field and pass it to the map service API. From the API, you’ll receive latitude and longitude points of the location. Now pass the latitude, longitude, and radius of the globe to the algorithm. The algorithm will provide x, y, and z coordinates of the location. You’ll use these points to plot a marker on the globe.

Summary

Now you have a Flex application that can plot accurate latitude and longitude points on a 3D globe of the earth. This is a fairly complex topic, but if you’ve made it this far and have been either creating or looking at the GeoGlobe classes, you have the beginnings of a great application. Now consider adding photos and videos or even tracking your friends as they roam the world. Definitely dig into Papervision3D and the map service APIs to see what else they have to offer. Both go far deeper than any one article can cover.


Thanks to the team at Papervision3D, Carlos Ulloa, John Grden, and Ralph Hauwert, for reviewing this article and source code. Special thanks goes out to Carlos Ulloa for verifying the usage and explanation of the math in the article. I also want to thank Cheyenne Throckmorton for his detailed review with great technical insights on the article. Finally, a big thanks goes to James Hastings-Trew of Planetary Pixel Emporium for letting us use his fabulous earth texture map. — Mark Walters

Free Version of Flash Page Flip

posted by Marcio Rosa in Flash

Free Version of Flash Page Flip has no advanced functions but it has some nice features like resizing and navigation. You can make and publish your own publications, check out this very nice free solution to dynamic flash page flipping. This free version is brought to you by the guys at FlashPageFlip also offers three other versions of this component which are the Pro PHP FlashPageFlip.

Features Include:

  • Tools:
    • Actual Size
    • Fit To Page
    • Sound On/Off
    • Quality Option
  • Navigation:
    • Cover
    • Back Cover
    • Next Page
    • Previous Page
    • Go To Page (Enter Page Number)

Other informative Resources:

Source: http://www.flashpageflip.com/FreeFPF.asp
Demo: http://www.flashpageflip.com/demos/free/
Tutorial on how to use free Flash Page Flip

Website controls (cross-domain policy files)

posted by Marcio Rosa in AS 3.0, Flash, Flex 3.0

To make data from a web server available to SWF files from other domains,you can create a cross-domain policy file on your server. A cross-domain policy file is an XML file that provides a way for the server to indicate that its data and documents are available to SWF files served from certain domains or from all domains. Any SWF file that is served from a domain specified by the server ’s policy file is permitted to access data or assets from that server. Cross-domain policy files affect access to a number of assets,including the following:

Data in bitmaps,sounds,and videos
Loading XML and text files
Access to socket and XML socket connections
Importing SWF files from other security domains into the security domain of the loading
SWF file

Policy file syntax

The following example shows a policy file that permits access to SWF files that originate from *.marciorosa.com ,www.friendOfMarciorosa.com and 192.0.34.166 :

<?xml version="1.0"?>
<cross-domain-policy>
<allow-access-from domain="*.marciorosa.com"/>
<allow-access-from domain="www.friendOfMarcioRosa.com"/>
<allow-access-from domain="192.0.34.166"/>
</cross-domain-policy>

When a SWF file attempts to access data from another domain,Flash Player automatically ttempts to load a policy file from that domain.If the domain of the SWF file that is attempting to access the ata is included in the policy file,the data is automatically accessible.

By default,policy files must be named crossdomain.xml and must reside in the root directory of the server.However,a SWF file can check for a different name or in a different directory location by calling the Security.loadPolicyFile()method.A cross-domain policy file applies only to the directory from which it is loaded and to its child directories.Soa policy file in the root directory applies to the whole server,but a policy file loaded from an arbitrary subdirectory applies only to that directory and its subdirectories.

A policy file affects access only to the particular server on which it resides.For example,a policy file located at https://www.adobe.com:8080/crossdomain.xml will apply only to data-loading calls made to www.adobe.com over HTTPS at port 8080.

A cross-domain policy file contains a single tag,which in turn contains zero or more tags.Each tag contains an attribute,domain ,which specifies either an exact IP address,an exact domain,or a wildcard domain (any domain).Wildcard domains are indicated by either a single asterisk (*), which matches all domains and all IP addresses,or an asterisk followed by a suffix,which matches only those domains that end with the specified suffix.Suffixes must begin with a dot. However,wildcard domains with suffixes can match domains that consist of only the suffix without the leading dot.For example,foo.com is considered to be part of *.foo.com. Wildcards are not allowed in IP domain specifications.

If you specify an IP address,access is granted only to SWF files loaded from that IP address using IP syntax (for example,http://65.57.83.12/flashmovie.swf ),not those loaded using domain-name syntax.Flash Player does not perform DNS resolution.

You can permit access to documents originating from any domain,as shown in the following example:

<?xml version="1.0"?>
<!--http://www.marciorosa.com/crossdomain.xml -->
<cross-domain-policy>
<allow-access-from domain="*"/>
</cross-domain-policy>

Each tag also has the optional secure attribute,which defaults to true .You can set the attribute to false if your policy file is on an HTTPS server,and you want to allow SWF files on a non-HTTPS server to load data from the HTTPS server. Setting the secure attribute to false could compromise the security offered by HTTPS.In particular,setting this attribute to false opens secure content to snooping and spoofing attacks.Adobe strongly recommends that you not set the secure attribute to false .

If data to be loaded is on a HTTPS server,but the SWF file loading it is on an HTTP server, Adobe recommends that you move the loading SWF file to an HTTPS server so that you can keep all copies of your secure data under the protection of HTTPS.However,if you decide that you must keep the loading SWF file on an HTTP server,add the secure=”false” attribute to the allow-access-from>tag,as shown in the following code:

<allow-access-from domain="www.marciorosa.com"secure="false"/>

A policy file that contains no tags has the same effect as not having a policy on a server.

Rodando Javascript localmente pelo Flash

posted by Marcio Rosa in AJAX, Flash

Todo Javascript executado localmente através do Flash é barrado pelo Global Security Settings panel da Adobe isso acontece por um motivo muito óbvio, porém poucos sabem liberar o acesso através do mesmo panel:

Acesse aqui e configure suas pastas, lembrando que localhost já vem liberado portando sempre é bom rodar seus scripts em um bom servidor web em seu computador.

Adobe Open Screen project

posted by Marcio Rosa in AIR, AS 3.0, Flash

Open Screen Project levará as rich Internet experiences across televisions, personal computers, mobile devices, e consumer electronics, o  Open Screen Project suportará technologias líderes, incluindo Adobe, ARM, Chunghwa Telecom, Cisco, Intel, LG Electronics Inc., Marvell, Motorola, Nokia, NTT DoCoMo, Qualcomm, Samsung Electronics Co., Sony Ericsson, Toshiba and Verizon Wireless, e provedores de conteúdo como BBC, MTV Networks, e NBC Universal, levando toda rich Web e video experiences, a toda variedade de dispositivos.

O Open Screen Project remove qualquer barreira de uso do Adobe® Flash® Player e no futuro, Adobe AIR™, fazendo com que qualquer empresa posssa inserir ambos em seus produtos sem custos de direitos de software. Isso é um grande passo para a área de desenvolvimento, e uma boa resposta a abertura do SDK para iPhone para desenvolvimento de aplicações.

Veja algumas barreiras que cairam com este projeto:

Remoção das restrições na utilização das especificações SWF e FLV/F4V e
publicação das APIs de portabilidade do Flash Player para dispositivos

Publicação dos protocolos Adobe Flash Cast e AMF
Não só foram publicadas as especificações SWF e FLV/F4V, como as especificações dos formatos de comunicação de dados usados pelo Flash Player.

Remoção dos custos de licenciamento do Flash Player e Adobe Air
Passa a tornar-se gratuíto distribuir o Flash Player e o Adobe Air.

JSON e Flash (ActionScript 2.0)

posted by Marcio Rosa in Flash, Flash Media Server, JSON

O que e JSON?
JSON (JavaScript Object Notation) é um formato leve para intercâmbio de dados baseado em um subconjunto do JavaScript (linguagem de programação baseada em ECMA Standard), mesmo padrão do ActionScript( ECMA 262). JSON é um formato de texto que é completamente independente de sua linguagem, apesar de utilizar convenções que familiares de programadores da família de C, incluindo C, C + +, C #, Java, Javascript, Perl, Python, e muitas outras.

ActionScript Resources:

Exemplo usando classe JSON.as (ActionScript 2.0)

import JSON;
var jsondata:LoadVars = new LoadVars();
jsondata.onLoad = function() {
var jsonObj = JSON.stringify(jsondata);
trace(jsonObj)
};

jsondata.load(”http://del.icio.us/feeds/json/marciorosa”);

Exemplo usando JSONConnector:


Download Fla Source

Novo! Desktop-Wallpaper

posted by Marcio Rosa in AIR, AS 3.0, Flash, Flex 3.0, Magazine

Novo! Desktop-Wallpaper Adobe technology platform ActionScript

Recent Posts
Recent Comments
About Us
Loren Norman: Brilliant! Straight to the point, and perfectly illustrates everything i need, even ...
melisa bruna: Estou interessada em fazer o Curso Gratuito de Flex....
Tom Humes: Nice Site layout for your blog. I am looking forward to reading more from you. Tom...
Pesquisa Anônima: Atencioso com a turma e sólido conhecimento sobre o assunto abordado....
Pesquisa Anônima: Márcio Rosa conseguiu cobrir todos os objetivos propostos pelo curso, e também abordo...