Category 'Flash'


April 2008: Farewell to the activation of the ActiveX for Flash

On the blog of Internet Explorer (IE Automatic Component Activation (Changes to IE ActiveX Update)) was announced a major change that materializes introns in April 2008 with the release of important patches, including the long awaited Service Pack 3. Preview, however, will be available by December 2007 from download center for Internet Explorer.

In April 2006, in fact, Microsoft had a patch introduced in Internet Explorer that blocked the interaction with ActiveX components present in a web page This "block" in the end is solved in explicit request - direct user / browser - to activate the control (Flash movie, QuickTime, etc ...) via the space bar or mouse click.

IE Automatic Component Activation (Changes to IE ActiveX Update)

In time, however, were introduced a series of shortcuts to avoid this annoying request official shortcuts (such as proposals by the same Macromedia Flash and Apple QuickTime) and unofficial ( SWFObject or UFO , for example - also see Unobtrusive Flash Objects ).
According to Microsoft developers should not modify anything in April 2008 in the "old" sites using shortcuts, however it is good to look at the blog of Internet Explorer for special cases.

Microsoft back then retraced his steps, and actually we had asked for a bit 'all that nonsense was that the activation of control, "patch" approach to a deficiency in the management of ActiveX (OBJECT tag) rather than to flaws in the components themselves. In other browsers, in fact, the use of Plugin is accompanied by the more solid EMBED TAG. Last note:

In the coming weeks, we'll be updating the MSDN article with descriptions of the new behavior. Keep an eye out here for When The preview goes live.

More ...

Add properties to a MovieClip

In Post Extend MovieClip in Flash MX I had some insight to extend a MovieClip. In particular, had said the use of MovieClip.prototype did not allow the extension of proprità but only of methods:

[...] Two important limitations of this technique are:

  1. It can not be applied to all objects exposed by Flash
  2. They can be "added" only methods and properties do not [...]

Indeed, it is possible, with an extra step, even dynamically add properties using MovieClip.prototype . , infatti, Flash permetteva l'aggiunta di proprietà (in lettura/scrittura o solo lettura) tramite il metodo addProperty() . Before the introduction of function get and function set , in fact, Flash allowed the addition of properties (read / write or read only) via the addProperty() . In practice this results in the invocation of the method addProperty() and the definition of two getters and setters. The setter can be null in order to create read-only property. For example if we wanted to extend MovieClip with an all new property _alpha able to animate, just write the following code:

1
2
3
4
5
6
7
: Number { _get_alpha function (): Number {
this . _alpha ) ; return (this. _alpha);
}
v : Number ) : Void { _set_alpha function (v: Number ): Void {
this , "_alpha" , Strong . easeOut , this . _alpha , v , 1 , true ) ; new Tween (this, "_alpha", Strong. easeOut, this. _alpha, v, 1, true);
}
prototype . addProperty ( "_alpha_tween" , _get_alpha , _set_alpha ) ; MovieClip . prototype. addProperty ("_alpha_tween" _get_alpha, _set_alpha);

From now on if we have a symbol "miosimbolo_mc" We can exploit this new property:

1
; miosimbolo_mc. _alpha_tween = 50;

. What you can do instead, is to overwrite the existing properties, which is why I used _alpha_tween instead of _alpha . Here, then, a good reason to still use the 2.0 classes to extend - and result - any MovieClip.

More ...

Movies resizable Flash: Act II

Returning to the Post StageExt Class: resizable Flash movies here is an even easier to get the same effect, only if the library for our movie is at least one Flash component!

Create a symbol, a red square 100 × 100 and place it in stages resizeWindow calling. Enter the library, not on the Stage, any component, such as a TextInput, and enter the following code in the first frame of the movie.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
managers . SystemManager ; import mx. managers. SystemManager;
/ /
scaleMode = "noscale" Stage . scaleMode = "noScale"
/ /
/ / SystemManager.init ();
( "resize" , resizeWindow ) ; SystemManager. AddEventListener ("resize", resizeWindow);
/ /
= function ( Void ) : Void { resizeWindow. resize = function (Void): Void {
Object = SystemManager . screen ; var s: Object = SystemManager. screen;
_width = s . width ; this. _width = s. width;
_height = s . height ; this. _height = s. height;
_x = Math . round ( s . x ) ; this. _x = Math . round (s. x);
_y = Math . round ( s . y ) ; this. _y = Math . round (s. y);
}
( ) ; resizeWindow. resize ();

Line 6 (SystemManager.init () ;) can be omitted.

More ...

Flash: how to initialize the components in the constructor of a class

When estente a class from other objects that it contains a MovieClip (MovieClip, TextField, etc ...) they may not be "ready" within the constructor. This happens especially when using more extended MovieClip or components (controls) of Flash. To solve the problem just use the onLoad event inherited from the class itself. For example imagine you have a MovieClip that contains a TextField object (static visual object inside flash) and a TextInput object (inserted control panel components) and want to set some property in the constructor of our class MyClass.

Example We create a symbol and insert inside either object TextField (let's call text_txt) is the TextInput object (textinput_txt). We associate this symbol to a class that extends MovieClip, call our class MyClass. What we get is that during the constructor of our class MyClass these two controls are initialized. If we try to use a code like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/ /
controls . TextInput ; import mx. controls. TextInput;
/ /
MovieClip { class MyClass extends MovieClip {
/ /
text_txt : TextField ; private var text_txt: TextField ;
textinput_txt : TextInput ; private var textinput_txt: TextInput;
/ /
function MyClass () {
"MiaClasse::costruttore" ) ; trace ("MyClass :: constructor");
/ /
= "Ciao" ; text_txt. text = "Hello";
= "Ciao" ; textinput_txt. text = "Hello";
/ /
}

}

More ...

Flash and code reuse: components and shared libraries

In view of the object-oriented programming comes naturally produce components for reuse in other projects, especially if these components are general-purpose. The use of classes is definitely a step in the reuse of code, however, often these classes are linked to MovieClip also extremely complex. Thus arises the need to "import" is the ActionScript class (which is very easy) but also all the symbols associated with it.

Creating Components in Flash

Flash Components This route is certainly the most correct from a strictly logical point of view. However, at least in the version of Flash MX, create a component that at least comes close to those provided with the development environment is no small feat. ) e la scrittura estremamente accurata della classe legata al nostro componente. The components, in fact, especially those visual, requires a whole series of procedures (such as the inclusion of the interfaces UIObject or UIComponent ) and writing extremely accurate class related to our component. But the fact remains that creating a component is an interesting experience to do, but the development time is truly remarkable. Also as a component must support the authoring mode in designtime or anything else that does not offer a preview of what will happen at runtime. You can associate an icon and a documentation fully integrated into the IDE of Flash, complete with intellisense when writing code. So here you choose this route involves a considerable expenditure of time, probably reserved for special projects where, for example, is precisely the component of the project objective.
There are software house specialized in the production of components for Flash, as both free and commercial products. Therefore excluding the components extremely simple, where for example there is no user interface, this method is excellent but temporalemte expensive and therefore not used in the majority of cases.

More ...

Fullscreen in Flash from the browser

Flash has always supported the full-screen (fullscreen) is in stand-alone player to the projector. This mode is still fully supported and has not changed. Instead Adobe has recently introduced the ability to directly activate the fullscreen movies displayed in the browser. We have introduced a new and simple ActionScript function that works with both players stand-alone player with the browser. ed <embed> . To make the fullscreen fuzionante must operate side HTML, adding a new parameter allowFullScreen in TAG <object> and <embed> . Everything else is left to the internal engine of Flash.
This new capability is still some restrictions that you must know, first of all use of the Flash Player version 9.0.28.0 or higher. Moreover, in summary:

  • Browser must be installed on the version of the Player 9.0.28.0 or higher
  • e <embed> . The developer must add a new parameter allowFullScreen tag in <object> and <embed> . This parameter is normally set to false and does not allow fullscreen. To enable fullscreen must explicitly set it to true .
  • A dialog box will be shown when entering fullscreen mode and tell you how to get out of that mode. This box will be visible for a few seconds, after that they will disappear by itself.
  • The activation of fullscreen ActionScript can only happen in response to a mouse click or by pressing a button, any other mode will be ignored in ActionScript 2.0 and trigger an exception throw in ActionScript 3.0.
  • In fullscreen mode you can not use the keyboard. The end user can not enter or edit text. The only answer is given to the keyboard shortcut used to exit the fullscreen mode (pressing ESC )

ActionScript

The code required to set the fullscreen is simple and uses the object Stage discussed on this Blog in StageExt Class: resizable Flash movies :

1
"displayState" ] = "fullScreen" ; Stage ["displayState"] = "fullScreen";

More ...

MagicLetter Flash Class: A class for writing magical

As promised here is the updated version of the sympathetic magical effect of the writing. I made a different animation for the "letter", to show how many effects you can do. The complete source can be downloaded here .

Flash Player Loading ...

Class MagicLetter

This is the code of that class, of course, can be further modified and improved. For example you can enter a parse for supprotare a symbol of "new line", to wrap words. Can be introduced functions get and set some properties to export outside, and much more.

More ...

Magic written in Flash

This I propose is an article I wrote in August 2003 (original title: Written magic in Flash MX). Despite being "dated" (now I would use a different ActionScript), in my opinion is a nice tool to truly enchanting effect. Propose later, or do you, the updated version with the use of classes ...

Dynamic MovieClip

The element that plays a key role nell'architetura Flash MovieClip object. The ability to create such objects from Flash code gives a remarkable potential, making it a decent development environment really fun. With the ability to add run-time objects of type MovieClip, we shall see how easy it is to achieve the effect shown in Figure 1.

Flash Player Loading ...

Figure 1 - Example of text effect

The class MagicText_class

Since we're using the version of Flash MX, we do things right and create a class MagicText_class be reused at will. What we're doing is defining a new class MagicText_class , which inherits all the characteristics of a class MovieClip. In this way we would have a real object, the basis for subsequently create a Flash component real! If we wish. For now let us dwell only on our class and see how to build it.

More ...

Write good OO code in Adobe Flash

Here are some tips on how to write good code Object Oriented (OO) in Adobe Flash, especially for those still using version MX waiting to move to CS3.

Organize classes folders

First of all, the organization of the classes makes the job of code maintenance extremely simple. You can also create a real library you can reuse in other projects. Flash uses a nomenclature related to the filesystem, then organize them into folders will also be reflected on the import of classes. For example, if we create the sequence of folders "mylibrary / graphics / plot" and insert our own ActionScript class "PlotClass.as" when we are going to import the class we should use:

1
grafica . plot . PlotClass ; import mylibrary. graphics. plot. PlotClass;

If the library (folder) "mylibrary" is not in your movie folder or project, use the Flash publish settings to select the path:

Setting percoroso libraries

More ...

Extend the MovieClip in Flash MX

I use two techniques to extend the functionality of a MovieClip. The first, used in previous versions of Flash MX, used the property prototype , a pointer to the superclass (parent), as indicated in the manual:

A reference to the superclass of a class or function object. The property   prototype is automatically created and associated to any class or function object created. This property is static and is specific to the class or function created. If, for example, you create a custom class, the value of properties   prototype is shared by all instances of the class and is accessible only as a class property. . Instances of the custom class can not directly access the properties prototype , but can be accessed through the property __proto__ .

One of the advantages of using prototype , especially with the MovieClip, resides in the extension of all the MovieClip, none esluso. In fact you make an extension to broadcast all MovieClip static or dynamic. For example, a convenient extension could be:

1
2
3
prototype . move = function ( x : Number , y : Number ) { MovieClip . prototype. move = function (x: Number , y: Number ) {
_x = x ; this . _y = y ; this. _x = x; this. _y = y;
}

More ...



Stop SOPA