negush blog

Flash, ActionScript and stuff…

Archive for the ‘Flash’ Category

February-9-10

ExternalInterface.call not working with IE

posted by admin

While working on a few PhotoSnack albums a few days ago, I’ve tested some features with several browsers but noticed that with Internet Explorer the albums were not working as supposed to. Specifically, the ExternalInterface.call() function wasn’t calling the target JavaScript functions at all.

After testing the JavaScript and ActionScript functions separately, it seemed they all worked without any problems. Anyway, the JavaScript functions were being called with no problems on all the other browsers I tested, except on Internet Explorer. After searching the problem on the Internet I came upon a comment on the ActionScript 3 documention posted on Adobe’s livedocs for the ExternalInterface class (thanks gerdy).

It looks like for the ExternalInterface.call() function to work in IE, the embedded Flash object MUST have the id attribute specified. Otherwise you won’t be able to display not even a JavaScript alert message from Flash. As soon as the id attribute was set for the flash objects in PhotoSnack, the albums worked just fine with Internet Explorer too.

So, as a best practice, I recommend always setting the id attribute of your Flash objects embedded in HTML pages.

July-2-09

FlashEff2 officially launched

posted by admin

Today JumpeyeComponents has officially launched the next version of the popular Flash animation tool – FlashEff. Now it has a redesigned workflow that makes life even easier and comes with a solution to lower the file size of your Flash clips: the FlashEff2 component has a lower size than the predecessor and it comes with another set of components – FlashEff2 Light.

The FlashEff2 Light pack contains separate animation components, each one specialized to do one of the main component’s jobs: show/hide animations for symbols, show/hide animations for texts, applying filters, creating buttons and executing commands. So you can use only that one feature you really need for your project without having to import all the FlashEff2 features into your Flash clip. This way you can lower the file size of the final animation even more.

Here are some other features for FlashEff2:

  • a large number presets that you can choose from (3000+ presets)
  • the possibility to tweak those presets or to make your own settings
  • create and save your own custom effects which you can reuse any time you want
  • a completely new button mode

Here you can find more information on the component’s features and watch some nice video tutorials that will help you get started with FlashEff2. There’s even a nice video on the home page based on the comments users left on this JumpeyeComponents blog post.

I’m testing the Red5 server to see how to use it for audio and video streaming but right after testing the connection to the server, I get the following error message in my Output Panel (though the connection to the server has been established correctly):

Error #2044: Unhandled AsyncErrorEvent:. text=Error #2095: flash.net.NetConnection 
was unable to invoke callback onBWDone. error=ReferenceError: Error #1069: Property 
onBWDone not found on flash.net.NetConnection and there is no default value.

After digging around it seems that I didn’t specify the client for the NetConnection object:

netConnection.client = this;

After setting the client property, all was well. So don’t do the same mistake as I did.

There are situations when you need to create a web application that is part Flash, part HTML, like some handy widget that must reside in an HTML page and that would also have to communicate with it. The next example presents a simple color setting widget made with Flash, which communicates with the web page it is integrated in. Basically the Flash widget contains three slides to set the RGB color value and the composed color is displayed in the HTML page, in a text input control. The user also has the possibility to enter a hexadecimal value of a color in that text input which will set the sliders in the Flash widget to the corresponding values. Flash – HTML communication (actually ActionScript – JavaScript communication) is possible by using the ExternalInterface class within the flash.external package.

The ExternalInterface class was created to replace the older fscommand() function and can be used to call JavaScript functions from ActionScript or call ActionScript functions from JavaScript. It is also able to transmit a return value from the function being called to the code (ActionScript or JavaScript) calling the external function. It is much more flexible than fscommand() since it allows calling any JavaScript function defined in the HTML file with any number of arguments (of various data types), while fscommand() allowed calling a limited number of functions with a single String as argument. Also allows receiving a return value from the JavaScript function call to ActionScript and vice versa.

Calling a JavaScript function from ActionScript is quite easy. All you have to do is call the static call function of the ExternalInterface class:

ExternalInterface.call("myJSFunction");

You can even specify function parameters and receive the return value, like this:

import flash.external.ExternalInterface;
var value:String = ExternalInterface call("myJSFunction", param1, param2, param3);

Of course this means that in the HTML file containing your Flash clip there has to be a JavaScript function defined with the name of “myJSFunction”. In the above example, we presume that the type of the return value of the JavaScript function is a String, but the ExternalInterface class allows receiving other types of values too.

Calling an ActionScript, from within your HTML document using JavaScript is equally easy. All you have to do is get a reference to the Flash object embedded into the HTML document and then call the ActionScript function directly on this object. Of course, this requires that the ActionScript function is defined as a callback function for the JavaScript code, in the main timeline of the Flash clip:

ActionScript code:

ExternalInterface.addCallBack("myASFunction", someASFunction);

JavaScript code:

var flashMovie = window.document.MyFlashWidget;
flashMovie.myASFunction(value);

In this case, the name and id attributes of the Flash object must be set to “MyFlashWidget”. Another requirement for the HTML document is to set the allowScriptAccess attribute of the Flash object to “always”.

“myASFunction” is the function name that the external JavaScript code must call, but the actual name of the ActionScript function is “someASFunction”. This way, external JavaScript code can only have access to the ActionScript code that the developer allows to. Also, in this case, if the ActionScript code must change and the “someASFunction” function is removed, there could be another function passed to the addCallBack method. Thus, it is ensured that “myASFunction” always gets called by JavaScript and that Javascript can actually be oblivious to the changes of the ActionScript code.

One more thing worth mentioning is that it is a good practice to check if the JavaScript code is available for calling, before actually making any calls to it. This way possible errors or malfunctions are avoided in the application:

if (ExternalInterface.available) {
	try {
		ExternalInterface.addCallback("myASFunction ", someASFunction);			}
	catch(e:Error) {
		// Callback function could not be added for various reson.
		// You could treat this situation here.
	}
}

You can download the full example from here. I hope it will help out some of you.

Update: For Internet Explorer you should make sure that you specify your embedded Flash object the id attribute, as mentioned in this post: ExternalInterface.call not working with IE.

December-17-08

Create Flash banners without Flash

posted by admin

Today JumpeyeComponents launched a new web application called BannerSnack that lets anybody easily create Flash banners and publish them. The product is still in its beta stage but most of the features are already implemented and working. All you have to do to create a Flash banner is to create your account on BannerSnack, access the application from the website and start using it.

By using a free account, you can create, save and publish your banners without problems but there are a few limitations in comparison with the premium account:

Free account Premium account
you can only choose from a limited number of banner sizes you can create custom size banners
you do not have access to all the setup parameters of the animations and filters you can fully customize the animations and filters
you have a limit of 25 MB of storage space for your images you have a 250 MB storage space for your images

All these limitations are gone if you purchase a premium account, which costs from $9 per month up to $149 per year.

The application itself is easy to use and has a fairly intuitive interface. The banners are based on a slide like structure with different types of transitions between them. You can use text and images for your banners on which you can apply different show/hide animations and filters. These filters and animations are based on the FlashEff engine, so you can use many of the eye-catching animations possible only with FlashEff.

Once you finished your banner, you can save it in your account and then publish it to the web. You can even set the banner to be public, which means other users will be able to access and edit it. Of course, their changes will not reflect in your banner, they will be saved separately.
But enough talking… I mean writing… For more information you can simply access www.bannersnack.com to check it out and to start using the banner maker application. There’s even have a short video presentation of the features of BannerSnack and you can also read a blog about a interesting stuff on marketing and banners (I’ve already subscribed to this blog… you should too).

November-28-08

How to preload AS3 clips

posted by admin

There are a lot of cases when your Flash animation is quite large in terms of file size. It contains images, perhaps some smaller .flv movies or a few “heavy” components.

In this case, if you publish your project somewhere on the web, you might have to wait a little, some times a little more, until the clip loads and starts playing. In this case it is very common (and quite frankly, necessary) to display something while your clip loads so the viewer knows there’s something going to happen and wait until your clip is completely loaded. In AS2 this wasn’t so hard. All you had to do was to move your animation to start from the third frame (but not necessarily), deactivate the “Export on first frame” setting from your symbols and components in the Library, place them on the second frame of your movie so they would load their assets (not necessary for all of them) by the time they would be instantiated, change the frame onto which classes were loaded from frame 1 to frame 2 and finally write some code on the first frame that would set an onEnterFrame event handler to display a preloader clip according to the size of your clip loaded so far. Lee Brimelow has made a nice video tutorial on how to preload flash clips, posted here: http://www.gotoandlearn.com/play?id=18. Again, this part isn’t necessary if you don’t want to display the amount of downloaded data and you only have a nice animation instead.

For ActionScript 3.0, the same thing is possible, only with the code changed to the AS3 syntax. You can download the example file from the link at the end of the post. However, this not always works. I’ve tried this with several components and looks like the method described earlier does not fully work. This is the case when using JumpeyeComponents’ TxEff or FlashEff. Even if you un-check the “Export in first frame” option from the Linkage Properties dialog box, there still is a considerable amount of data loading on the first frame. Don’t know why, yet… probably it has to do something with the embedded text (remember that TxEff and FlashEff need embedded characters for text effects). If this is the case, then you’ll probably have to wait a while until even your preloader shows up.

A workaround I’ve been using for this problem is to create the animation clip normally, without considering any preloading and then create a second clip I would use to load the first clip. This second loader clip would have all the preloading capabilities implemented into it. So, now I’m preloading an external .swf file. There’s also an item in JumpeyeComponent’s Knowledge base that addresses this issue: http://www.jumpeyecomponents.com/knowledgebase/TxEff-AS3.0/Preload-TxEff-animations~439/.

However, this arises another problem: in case of timeline animations, if that animation is in the external .swf file that you’re preloading, it so happens that the animation would start before the preloader is gone (while the preloading action is still going on). In this case, there’s a simple solution: move the entire timeline animation so it starts on the second frame and on the first frame place a stop() function. This way, your swf will not start the animation. Finally, after all the external .swf is loaded, just access the content in your loader object and instruct it to start playing from the second frame by using a gotoAndPlay(2) or gotoAndStop(2), if that’s the case.

You can check out these examples I’ve made.

July-24-08

How to install Flash components

posted by admin

During my days of customer support I’ve come across clients who asked for directions on installing the Flash components made by JumpeyeComponents. There are people who are just starting to work with Flash and are having trouble understanding key concepts or simply don’t know how some operations are made. This is why I thought it would be good to have detailed instructions on how to install .mxp files (Flash components setup files).

For starters, you need to have the installation file of the component, which comes in the form of a .mxp file. If you purchase a package of some sort, first you need to open that archive and retrieve the .mxp file(s). All Flash components are installed by a separate application called the Extension Manager. Usually, this application is installed together with other Adobe products (like Adobe Flash) but that is not necessary. So if you do not have the Extension Manager, you can download it from Adobe’s site: http://www.adobe.com/exchange/em_download/. If you are still using Macromedia Flash 8, you can use Macromedia Extension Manager 1.7 and you can download it from the same location. Please note that if you want to install Flash CS3 and ActionScript 3.0 components, you can only use Adobe Extension Manager 1.8 and Adobe Flash CS3. The previous version of Extension Manager will not be able to install components for Flash CS3.

Adobe Extension Manager

Before installing a component, it is recommended to close Flash CS3. Once you make sure that you have all the necessary applications installed and you have the component’s setup (.mxp) file, you can open that file simply by double clicking on it.

mxp file

Once the Extension Manager opens it will ask you if you really want to install the component. The window will display the manufacturer’s disclaimer or license agreement. If you agree to it, the installation process will go on, but if you decline the agreement, the component will not get installed.

Disclaimer and license agreement

Once the component is fully installed, a message will let you know about it.

Installation complete

Just press Ok and the newly installed component will appear in the components list.

Installed component

Now, you can open Flash CS3 and select Create new Flash File (ActionScript 3.0) from the welcome screen or selec File -> New from the menu (Ctrl+N on Windows or Command+N on Mac OS) and select Flash File (ActionScript 3.0) from the New Document window. You need to create a new ActionScript 3.0 file because FlashEff is a ActionScript 3.0 component and will not work in a ActionScript 2.0 project. Finally, if you open the Components panel (Ctrl+F7 on Windows and Command+F7 on Mac) you will see that the FlashEff component was installed, together with the patterns it has.

Flash CS3 Components panel

Also, in the case of the FlashEff component, there was a new Flash panel installed: the FlashEff panel. You can access it from the Window menu -> Other panels -> FlashEff Panel.

July-8-08

FlashEff at Flashbelt and FITC

posted by admin

My colleagues who went to present our brand new component, FlashEff, to the world, came back two weeks ago from the Flashbelt and FITC conferences. Overall, it seems that many people got interested in it and everyone who heard about the project was very impressed with it. This is a good sign for us, especially since we’ve just launched the final version (so no more beta).

While we were working on the component, we had really useful input from people with high expertise in Fash and ActionScript, many of them highly regarded in the Flash community. So the difference between the FlashEff beta and the final version is very much based on their feedback. Thank you very much to all of you.

Of course, we cannot create a product that would please absolutely everybody in the Flash community, but we tried to do our best in creating a component that would be easy to use (especially for those new to Flash) and also, leave an open door to those experts who like to code more than use the visual workflow.

There is a free version that has 30 patterns, which you can use to create show/hide effects on text, apply filters on clips and create buttons from movie clips on the stage, fast and simple. You can download it from the component’s main page and test it out. If you’re happy with it and want more, you can even purchase a full version that includes all the current (100) and future patterns. Also, we’ve changed the initial pricing model and now you can purchase the component for 1, 6 and 12 months. Also, there’s an unlimited version of the component, which costs a little more than the rest. For more information, you can check out the component’s site: www.flasheff.com.

May-22-08

A new Flash animation tool

posted by admin

I know it is sometime since I wrote my last article, but in the past few weeks I really had my hands full. Besides working hard to offer the best customer support service I can for JumpeyeComponents, I helped my colleagues that are working on a new animation tool for Flash. This is the first tool of its kind… of this “magnitude”…

In the past few weeks the entire Flash department has worked hard on what will be on of our most complex Flash components: FlashEff. This animation tool will provide the combined functionality of the MovieClipTransitionEffect and TxEff components all together and much more. This is going to be the best animation component ever. Right now, we are in the beta stage with it and can’t wait to have it finished and released. For the first time, we are going to publish an API of the component so that other Flash/ActionScript programmers can create and publish their own patterns for this component.

If you would like to find out more about it and see it in action, a few of my colleagues (Gabi – our CEO, Raul – the CTO – head of the Flash department and Alin – our PR manager) will give demonstrations of the component at a few international conferences. Right now they are in Cologne, Germany, attending the FlashForum conference. We’ll also be present (maybe not personally) at a few other major conferences like FITC Chicago in June and Flashpitt 08 in October.

March-18-08

Promotion for text effect with reflection

posted by admin

Jumpeye has just launched a short promotion for a limited edition of TxEff: TxEff with reflection. All you have to do is to create your own text animation on www.txeff.com, save it and then embed it into your own site using the HTML code provided on txeff.com. Just like I did…

Hurry up ! It’s only available for a few days…