Jun 16 2008

Flex/Flash Fullscreen problems

Published by under AS 3.0,Flash,Flex

I have been playing with Fullscreen mode of Flash in Flex and had this annoying problem.

My listener is setup,

Application.application.stage.addEventListener(Event.RESIZE,stageResized);

private function stageResized(event:Event):void{
    mx.controls.Alert.show(Application.application.stage.displayState);
}

and then I call the function which looks as follows,

private function fullScreenFunction(rect:Rectangle):void{

    if (Application.application.stage.displayState != StageDisplayState.FULL_SCREEN){

        Application.application.stage.fullScreenSourceRect = rect;
        Application.application.stage.displayState = StageDisplayState.FULL_SCREEN;
    }
}

Nothing wrong so far, the reason i am doing it this way is because i need to make different sections of Application full screen.

This is the function call i make, my application is 1024×768,

1
fullScreenFunction(new Rectangle(1,1,1022,766));

Above function call triggers the stageResized properly but,

1
fullScreenFunction(new Rectangle(0,0,1024,768));

doesn’t trigger the listener.

I have no clue why it does that and also i haven’t bothered to find out because that one pixel isn’t that important to me.

No responses yet

Jun 10 2008

Flex Videodisplay Component Problems

Published by under AS 3.0,Flex


These are the problems i faced in Flex 3.0 inbuilt videodisplay component. I had tried using it but gave up on it a couple months ago this post is written. I created my own videodisplay component for our application.

  • There is no video smoothing option, Very very weird since that was introduced in Flash player version 6.
  • You cannot get the netStream.bufferLength property, there is no getter for it. So you cannot display the buffer status. 
  • If you are encoding flv files which broadcast onLastSecond near the end, it will throw an error. 
  • Also there was a state problem, the player would go into unresponsive state while seeking or something like that which was completely messing up the video.

There was some else major as well but i can’t remember right now, i think it was the way videos were playing. Anyway i am happy with my custom component, which works perfect for our application.

 

I have seen that this post is the most popular among the very few posts i have, so if you need any help writing your own video display component i will be more than happy to share my knowledge. Sorry i can’t share the code for the component i have created.

 

edit: July 20th 08. 

 

Flex component might also give you problems while seeking the video to the end, specially if your buffer is long. lets say if you have a buffer of 20 seconds and someone seeks to the last 18th second then the status will be buffering and since the buffer would never get full. The status of the video will be buffering always and the video won’t play. 

 

In my custom component i had to add a condition to see the seek time and buffer length etc and then accordingly change the status of the video.

 

96 responses so far

May 21 2008

Tile Painter Application

Published by under AS 2.0,Flash,Work Examples

This is an old Application i did sometime during July – Sept 2004. Here is the link to it,http://www.nayansavla.com/tilepainter/

You can selected the tiles from the drop down menu on the left and then paint them, layout will allow you to rotate the tiles etc.

I don’t have it connected to the php backend which allows to save and retrieve your work.

6 responses so far

May 20 2008

Allowing Popups to work

Published by under AS 3.0,Flash

In AS 2.0 or earlier when you use getURL to open up a new browser window, usually it wouldn’t get blocked by popups if the getURL call was made onRelease event instead of onPress. But with navigateToURL introduced in AS 3.0 its a different story altogether. 

navigateToURL works fine with Safari but doesn’t work in Firefox (I am a mac user so i personally test in these two browsers). Anyway to make sure that popups open we have to use some javascript and call it from our Flash.

Adobe recommends we use ExternalInterface since the 9.0.124 update. So here is my Flash code,

var boolean:String = ExternalInterface.call("openWindow", url);

if (boolean == "false"){
    navigateToURL(new URLRequest(url),"_blank");

}

and my Javascript would look something like this,

function openWindow(pageUrl) {
    var winName = Math.round(9999*Math.random()) + new Date().getTime();
    var winNew = window.open(pageUrl,winName,"toolbar=1,scrollbars=1,location=1,statusbar=0,menubar=0,resizable=1,width=800,height=700,left=200,top=100");

        if(!winNew) {
            return "false";
        } else {
            return "true";
        }
    }

So with this method we first try to open a window using Javascript, Firefox is happy with that and hence it returns true and flash doesn’t make a call to navigateToUrl. Safari blocks the javascript popup and hence true is returned to Flash and using navigateToUrl you can open up a new browser window.

It seems to work with IE as well otherwise i would have got a bug reported from the QA team. :)

7 responses so far

May 13 2008

New Version of Brainvita

Published by under Work Examples

Brainvita was the first game i created in Flash and it was done sometime in early 2000 using Flash 4. I vividly remember how the only programming that could be done is using drop down menus. 

I lost the source code for it when a Linux installation attempt went bad and i lost all the data. I had backup of the swf file but then it had this annoying music which wasn’t fun. 

I then decided to re-create it in Flex and here it is. I need to work on the graphics and add more functionality to make it a nice Facebook application.

The rules for this game are outlined here. http://en.wikipedia.org/wiki/Peg_solitaire

One response so far

Sep 28 2007

Problems with getURL.

Published by under Flash

This issue was mainly caused by some server side configuration (i think) but here is what the problem was, we were trying to implement a bandwidth sniffer to redirect the user depending on their connection speed but for some reason after detection of the bandwidth accurately we couldn’t redirect.

 

After lots of frustrations and numerous attempts, even tried using loadvars.send method it still wasn’t working. Finally someone came up with a suggestion that lets use “allowscriptAccess” parameter in our html and set it to “always” and there it was.

 

The redirection was working fine and everything else was as expected. So for some reason if getURL fails for you try adding this html parameter and try it out.  

No responses yet

Sep 20 2007

Using Interfaces with Actionscript 3.0

Published by under AS 3.0

This is a very basic example of how you can use interfaces in Actionscript 3.0. The complete set of file can be downloaded here.

Specified file is not in uploads folder, does not exists, or not a file.

No responses yet

Sep 16 2007

WordPress First Impressions

Published by under General

Ok now that i have published two blogs i have decided to publish this blog describing my WordPress experience.  I was looking for a blog publishing system and thought of creating mine in Flex but i wasn’t sure if google would catch the pages since i intend to publish bunch of Flash tutorials. So after few searches i decided to with WordPress. Installing and setting up WordPress was really easy and went without any hassles whatsoever.After selecting the theme, I decided to publish some blogs and found the editor to be little annoying, here is why.I like to format things and since i know basic HTML i prefer to write in code mode but then once i switch to visual mode and back all my p tags go away……also creating links with the graphical interface was pain so i decided to stick completely to the code mode and not use the visual tab at all…..lets see how it goes, also if you have other suggestions please let me know.I hit save and continue editing, it takes me to visual tab and hence i loose all my p tags and formatting *sigh*ok so i have decided to use hr tags to differentiate because they seem to get saved.

No responses yet

Sep 16 2007

Why isn’t removeMovieclip isn’t working

Published by under AS 2.0,Flash

This is one of the most annoying problems i faced, its very easy to attach movies on stage using following, 

myMovie.attachMovie("movName","newName",myMovie.getNextHighestDepth()); 
 

all is fine with this and no matter how many movies i add they will be on stage but when i want to remove the movies from stage i just do this

myMovie.newName.removeMovieClip();
 

however this line of code won’t remove the movie if the depth is greater than 1048575, usually this could happen while using version 2 components.It is really well documented by Adobe but hey who reads documentation unless necessary. I avoided this problem by just using fixed numbers for depths and it has worked beautifully. It might look simple but when this problem hits you it can be really frustrating.

No responses yet

Sep 16 2007

My Flash Experiences….

Published by under Flash

Hi All, I have been working in Flash since 2000 but mainly as a hobby until June 06. Since that time i am working with Cyberflow Solutions  as Flash Developer. It has given me enough exposure to Flash so that i can call myself advanced programmer maybe not a thorough expert. I intend to post some of the general problems i have faced in Flash and how i have overcome them. Some of them might seem trivial to you but for many people out there it can be frustrating and really annoying.Also I want to move towards creating architectures for large scale projects and therefore i intend to publish a series of articles on Design Patterns and how can they be implemented in Flash along with few simple Flash tutorials. I hope you all might find them helpful and entertaining.

3 responses so far

« Prev - Next »