Scrolling in Flash

I have been getting a lot of questions for a good way of scrolling in Flash. So I thought I would let you know about the Scroll Flash Tutorial I made on how to do that. It gives you the code and the explains  basic functionality.  But if you don’t know anything about programming, I also created a simple Auto Scroll Flash file or in other words a Flash Text Ticker / Text Scroller file.  It’s completely customizable by XML so you don’t even have to know Flash to use it and it super easy to add to any website. You can change the font size, color, link color, background color, and add multiple lines of text if you want, and you can even setup a timer to display each text line item. If you buy it, there is also a help file that will give you a step by step process on how to edit the XML file and add the Flash scroller to your webpage.  To see a few examples of this file in action, click the example  image below.

If you guys have any more specific questions about scrolling in Flash,  just let me know by sending me an email through my contact page or leaving a comment.

Cya

Workaround Solution to Flash Error #2044, Unhandled SecurityError, and Error #2048, Security Sandbox Violation

I sell Flash components on ActiveDen, and while working with a client on my Flash News Ticker we ran into the infamous “Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation” when trying to gather information from an external RSS Feed.

This error occurs when your flash file is trying to get data from a different domain and it can’t because of security reasons on their server. The usual fix for this is to create a crossdomain.xml file that allows access from other websites to use the data on yours, but the problem with that is if you don’t host that site you want the data from then how could you create or update the crossdomain.xml file on their server.

I did find a work around for it though! Not sure if its “the right way to do it” but it does work.

Here is the solution, I copy that url of the feed I want the data from, go to my feedburner account and create a feedburner feed of the same feed. If you don’t know what feedburner is then you should definatly check it out. You basically can sign up for feedburner if you have a google account already. Anyway, after you get the feedburner feed of the data you want you can view it. Then if you want to see the xml version of the Feedburner Feed, you can just add  “?format=xml” onto the end of the url they give you, and this is the normal RSS 2.0 feed that we are wanting.

This is the data you want, because its not on the security problematic website. The next thing I ran into was getting the images to display in the news ticker as well. I kept getting the same error but if I dismissed the errors then they still worked. So I used a try-catch clause to get the error and throw it if it gets one. Here is an example of that code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
function imageLoaded(e:Event):void {
	try {
                //make the image into a bitmap and smooth it
		var image:Bitmap = e.target.content as Bitmap;
		image.smoothing = true;
 
		//resizes the image
		e.target.content.width = 55;
		e.target.content.height = 35;
 
	} catch(error:Error) {
		trace("Error catch: " + error);
	}
}

This is called from an event listener when loading it in using a loader object, that looks like this:

imageLoader.contentLoaderInfo.addEventListener(Event.INIT, imageLoaded);

So basically it worked after this, and the images even showed up without showing the error. The only problem is that the images don’t get resized because they can’t be loaded into the swf memory. Here are the examples: the one on the left is the broken example, it can’t get the information it wants to so it just keeps trying to load it. The example on the right shows the fix. (You have to view them in IE so the error warnings appear, another thing to hate about IE. :/ )

Any thoughts or comments are encouraged,
Cya

Actionscript 3 Fix for the Flash Fullscreen Problem

I have come across an error while working with Flash Fullscreen. The problem occurs when you have certain publish settings. The publish setting are in the html tab -> Window Mode -> Transparent Windowless. So the SWF file is basically transparent like a PNG image. It has trouble knowing where the stage is on this setting. So I came up with  a work around or fix that takes care of this. To fix this you have to create a background movieclip that resizes to the stage size that is hidden as well, so its alpha is zero, so that Flash recoginzes that your mouse is still over the swf file, I know its weird but this works.

So add a movieclip to the stage that is the same size of the stage, but make the color’s alpha zero. Make sure the instance name is “bg” then in the actionscript add this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
    //import library files
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    import flash.events.Event;
 
    //reset the background movieclip function
    resetBGsize();
 
    //set the stage scalemode and alignment to no scale and top left
    stage.scaleMode = StageScaleMode.NO_SCALE;
    stage.align = StageAlign.TOP_LEFT;
 
    // add an event listener to the stage for when it is resized
    stage.addEventListener(Event.RESIZE, onResizeStage);
 
    //onresizestage function for the event listener, calls resetBGsize
    function onResizeStage(e:Event):void {
       resetBGsize();
    }
 
    //resetbgsize function resizes the background movieclip and centers it
    function resetBGsize():void {
       bg.width = stage.stageWidth;
       bg.height = stage.stageHeight;
       bg.x = stage.stageWidth / 2 - bg.width / 2;
       bg.y = stage.stageHeight / 2 - bg.height / 2;
    }

Hope this helps someone out.

Cya

Flash Link Problems

So I got a new computer at work and it’s amazing how much more work you can get done when you aren’t sitting around waiting for you computer to finish tasks. While checking out my site on the new computer and looking at my WordPress and Flash integration files, I figured out they weren’t working correctly. There was a problem with the links  working with the wordpress plugin shadowbox that I have installed on my wordpress template.  And after searching around for a while I found this TechNote on the adobe site. It basically says that Flash Player 9 and up does not work properly when calling Flash Player movie (SWF) files located in a different domain (or directory) than its hosting HTML page.

This  made sense of why mine weren’t working correctly, because when you add media to WordPress it saves it in the “wp-content/uploads/” directory. So the workaround they tell you to do is to make sure that the HTML that runs the SWF file has the param allowScriptAccess’s value set to always.  For example,  “<param name=”allowScriptAccess” value=”always”>”.  And then they also say to make sure that the when using a link to use “_blank” as the target, which will cause your browser window to open the link in a new window. After I did this it worked again, which is great unless you want the browser window to open the link in the same window.

Cya

SWF Address and Deep Linking in Flash

The next step in being able to integrate my wordpress blog with Flash is to start to understand and implement SWFAddress. SWFAddress gives Flash the functionality of deep linking and comes in a small, but powerful library.  Some great things that SWFAddress can do is utilizing browser history and reload buttons. That’s all for now.

Cya