Exception Handling In Flash - Best Practices?
I have just completed a massive project with over 40,000 lines of actionscript 3 and I realise I didnt use try{}catch{} anywhere...now this seems pretty bad, but....
I used addEventListener to catch for errors when dealing with errors with external data (file loads, remoting calls, url requests etc..) and I used logic for any null pointer type exceptions that occured during development, e.g.
if(movieclipInstance != null && movieClipInstance is MovieClip && movieClipInstance.parameter == thing) { //process stuff with movieclipInstance here
}
Stuff i've been reading says its takes more resources to catch exceptions than to logic them out or use event listeners, and articles about exception handling for other languages e.g. c# never seem relevant enough for Flash.
So I am wondering what approaches other actionscripters use when dealing with exceptions ... and where might be a good place to use try {}catch{}
Ultrashock Forums > Flash > ActionScript
Posted on: 2008-12-18
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Exception Handling
So I'm implementing the AS2Lib exception handling library and I'm running into a weird issue:
When I run a try...catch statement within the actions panel, it compiles and executes perfectly. However, when I place a try... catch statement within a class, I get a compile-time error:
**Error** Macintosh HD:Users:bjackson:Shared:CVS:src:com:incomum:test: TestClass.as: There is no property with the name 'e'.
**Error** Macintosh HD:Users:bjackson:Shared:CVS:src:com:incomum:test: TestClass.as: Line 10: There is no method with the name 'e'.
} catch (e:Exception) trace(e.toString());
Code sample 1 (in actions panel):
import org.as2lib.env.reflect.NoSuchChildException;
try {
var presenterClass = ReflectUtil.getClassInfoByName("dummy");
} catch (e:NoSuchChildException) trace(e.toString());
Code sample 2 (class file):
import org.as2lib.env.reflect.*;
import org.as2lib.env.util.*;
class TestClass
{
function test() {
try {
var presenterClass = ReflectUtil.getClassInfoByName("dummy");
} catch (e:NoSuchChildException) trace(e.toString());
}
}
Anyone run into this issue before? Any help will be much appreciated.
FlashMX Exception Handling
I am having a problem trying to implement some exception handling with FlashMX Remoting. Currently when a user logs on to the site a function is called that ask the DBMS if the current user name and password are correct. If the server where to fail(I purposely turned it off) the site would never advised the user that an error had occurred or that the server was unreachable.
I am excepting the default responder in the service Object which makes the function call have the following syntax:
serObjCatSite.ValidateUser(UserName_txt.text,Pass_ txt.text);
I then have the following 2 functions:
function ValidateUser_Result(result)
{
//code to do if everything is ok
}
function ValidateUser_Status(error)
{
//code to do if an error occurs
}
The ValidateUser_Status() doesn’t work ANY insight as to what I am doing wrong would be GREATLY appreciated.
LoadvariablesNum Exception Handling?
How to catch the exceptional event when loading a non-existing file using loadvariablesNum?
Is there a better way than looping until timeout?
Thanks a lot!
Global Exception Handling
Any thoughts on a good way to catch (and respond) to exceptions only if they reach the 'root' of my application, i.e. not caught by any lower level handlers? My purpose for these handlers is debug-only.
As far as I can tell if exceptions bubble up to the root they evaporate -- silent failure!
The only solutions I've come up with so far are a) manually adding try/catch to every 'entry' function (event handlers, etc). ack. or b) hacking MTASC to automatically generate function wrappers w/ conditional try/catch.
Thanks for any ideas,
Darrin
Exception-Handling Cycle - Why Bother?
I've got a basic understanding of how the try/catch/finally block works, but I can't seem to figure out why I should bother using it.
If I know an error is occurring or about to occur, why build a try/catch/finally architecture to 'gracefully' handle the error when I could write code to prevent the error from occurring in the first place?
Thanks in advance for any enlightenment on this subject.
Exception-Handling Cycle - Why Bother?
I've got a basic understanding of how the try/catch/finally block works, but I can't seem to figure out why I should bother using it.
If I know an error is occurring or about to occur, why build a try/catch/finally architecture to 'gracefully' handle the error when I could write code to prevent the error from occurring in the first place?
Thanks in advance for any enlightenment on this subject.
Best Practices For Handling Multiple Xml Galleries
I'm working on a project that will require me to load at least five different xml image galleries with at least 40 entires per gallery. Previously, I've only needed one gallery so I currently have my project only calling one xml file.
I've been reading up on how to accomplish this in the most effective manner and I've seen examples done different ways. Some only use one xml document and separate the galleries into categories within that one document and some call five different xml documents for each of the five image galleries. So my question - is one practice more effective/efficient than the other when working with 5+ categories and 40+ entries? My current setup is that I have five movie clips on the stage so each movie clip should call a separate gallery (and remove one if it has already been loaded). So I would like to pursue the method that is most closely aligned this existing structure - also keeping in mind that I already have one fully coded and functional gallery to work with.
Flash Application Exception
Every time I try to start Flash MX 2004 on a Windows XP Pro SP 2 machine, I get the "Flash MX 2004 has encountered a problem and needs to close" error window. From the technical information in that window, I get:
Error Signature:
AppName: flash.exe AppVer: 7.2.0.581 ModName: urlmon.dll
ModVer: 6.0.2900.3020 Offset: 000037b4
From the Event Log, I get:
Faulting application flash.exe, version 7.2.0.581, faulting module flash.exe, version 7.2.0.581, fault address 0x0005ebd3.
I also get this from the event log:
Faulting application flash.exe, version 7.2.0.581, faulting module urlmon.dll, version 6.0.2900.3020, fault address 0x000037b4.
From the Dr. Watson log I get:
Application exception occurred:
App: C:Program FilesMacromediaFlash MX 2004Flash.exe (pid=2532)
When: 3/16/2007 @ 15:30:13.177
Exception number: c0000005 (access violation)
What should I do next to troubleshoot this error? I have tried reinstalling Flash (but not the entire studio).
Thank you.
Flash Best Practices
Can anyone suggest any best practices when developing a Flash game, which will be used on an html page. For example, are there any best practices when coding that I should follow to have the best possible chance of Search engines at least indexing my game, and in the best of possible worlds, ranking it for terms by use of the SDK program.
I am already, adding metadata (title and description)
Using static text for any textual graphics.
Other than that, I am not sure where to go.
Flash 8 And SEO Best Practices
Can anyone suggest any best practices when developing a Flash game, which will be used on an html page. For example, are there any best practices when coding that I should follow to have the best possible chance of Search engines at least indexing my game, and in the best of possible worlds, ranking it for terms by use of the SDK program.
I am already, adding metadata (title and description)
Using static text for any textual graphics.
Other than that, I am not sure where to go.
Best Practices With 3d In Flash
Does anyone have some best practice suggestions when dealing with importing movie clips into flash and how to optimize the bang / kb of file size??
any help whatsoever would be appreciated!!
Flash Best Practices
I'm working on a Flash project and would like to know what are considered "best practices"
Is it better to keep your flash project in one large file or several small files?Is there any limit to the amount of frames you should use? For example, is it ok to have 1000+ frames?I often hear to avoid using scenes, is this true?Do instance names need to be unique? For example, can I have several MediaPlayback components with the same instance name?
Flash Dev Practices. Give Away The FLA's?
Hi Folks,
I have been subcontracting Flash pieces for a company for a few years and recently they started asking for the FLA files as well.
It seems the real value in what I do for them is of course conceptualing, architecting, and coding visual ideas. There's also a fair amount of original art in the pieces as well. Once that's done, content could be easily swapped out, creating derivative works, art objects re-used, etc. On the other hand, they probably shouldn't need to consult me every time there is a minor content change for their clients.
Just curious as to what everyone's thoughts on the matter and general practices are... sort of an informal survey.
Very curious to hear your experiences,
Paul
Best Practices For Flash Detection
I have a full-flash site I am about to launch that I need to come up with a strategy for on how to bring people into it. The site does not require full-screen or a popup launcher however, it seems like bad form to just throw someone the site without a warning of some kind. Also, I find that some of the auto-redirectors are a little heavy handed and prevent some other users getting into the site so, I prefer not to go that way unless it is bullet-proof.
What do you prefer to do? I am leaning to an entry page - any reasons against it?
-mx
Best Flash Website Practices
Hi there,
I'm creating a flash website of my portfolio and, even though I am not very good with AS, and I'm probably over complicating my life the way I'm doing it, I would also know which is the best/most usable way of creating a Flash website.
What I mean is, I was taught to do the browsing through scenes, but I read somewhere that that's not a very good practice.
So I thought of creating each .swf separately and calling it through a loadMovie, but I got stuck when it goes in the movie, to call back another .swf (meaning, the different sections of the site that are browsed through with the menu buttons).
Does anyone know which would be the best way to set up the flash website?
Thanks,
N.
Best Practices - Resizing Flash Project
I've always wondered if there is a better way to do this. I'm working on a project that will eventually be included on a webpage. After a redesign of the webpage I realize the flash file needs to be resized to fit. However just going in and changing the file's width and height stretches out the content.
My solution in the past has been to create a new file from scratch and just copy and paste timeline, scripts and library into the new file. But this would be impractical for complex files. Is there a way to get flash to resize the document without stretching everything? I would like it to just add extra canvas the way photoshop does when you adjust the canvas size.
Possible?
Hosting Best Practices- Flash Presentation
Hi
I am working on a project for a client that will create a flash presentation using Articulate that will be, with all of the swf's , myp3's and video file, will be 2.5 MB.
The presentation may be viewe by up to 1, 000 people, most likely not simultaneously. I am trying to find an appropriate host and have the following options:
1.) There are several companies out there that say they specialize in hosting flash, but don't have the flash media server. THey use shared servers.
2.) Install on a Dedicated Server
3.) Host with a provider of Flash Media Server....
I was wondering what would best practices for hosting this. Thanks in advance for your help
Dave
Full Browser Flash - Best Practices?
hey all!,
just wondering what would be the best practices for full browser flash "example@kirupasiteoftheweek" something along those lines i have an idea where you have to centre your stage etc...but how large should you make the stage size and your bg or say photoshop files what dimensions should they be??
Also if anyone knows of any good tutorials on it please give us a shout
cheers in advance peeps
Flash Best Practices - Structure Newbie
Delurking, first time post--I've been reading through the forums, but I can't find my answer, so if someone has a link because I'm blind, that's excellent too!
I'm trying to write a portfolio gallery, and I'm uncertain what the best way to optimize user experience is. I'd just like a series of images, and when the user clicks the image or a button, to progress to the next image. Some descriptive text will be available below the image.
Now, is it faster to put everything in the timeline? To load external .swfs? To externally load even the images in those swfs? For the text handling, is it better to pass out some external variable and just use HTML? Should I learn XML and use that instead?
We're using MX 2004. I've tried to ask this sort of question in class, but the teacher is a little hostile and just keeps saying "There is no right way". Which, fine, but I've experienced enough bad flash sites to not want to contribute to more!
Thanks in advance for helping a newbie out.
Best Practices - Flash Image Carousel
When creating an image Carousel in flash for a web page, what are the best practices for loading quickly and changing images?
So for instance, on an ecommerce site, the home page often has a block created in flash in which 4-6 images are included with arrows or image numbers are displayed at the bottom as buttons. The images automatically change to the next ever x seconds unless the user selects an image number or the forward/back arrows.
Obviously, smaller the image the better. But how about best practices for things like:
Do you include one image in the block and then load dynamically the other images? Should all images be dynamically loaded if you want to change them on a daily/weekly basis? Any suggestions for making sure the images, especially the first one is loaded quickly?
Anyone have sample ~gpl code that demonstrates a block like this?
Two examples - kohls.com, jcrew.com
Best Practices For Architecture Of Flash Site?
hey there,
So I've done a lot of tutorials and have tried to mostly learn about actionscript - and Im ready to make two sites.
One is more traditional, with a constant navigation bar, and one is non traditional with constantly changing buttons, and sometimes quicktime movie interludes between the scenes.
My question is, how would people suggest that I setup the above two? for navigation bar style sites, are slides the way to go?(is that what everone does, or do people use the visible/invisible a lot...) I am trying to avoid the gotoAndPlay for navigation (which I think is standard practice?)
The second one I'm not really sure how I want to do it, cause buttons that will pop up everywhere will not be constant in where they take you.
Any sort of short summary of what people actually do would be severly appreciated, as I dont know where to start to put in my time and energy.
Flash/AS3 Good Development Practices Question?
Does anyone know what happens when you have Actionscript in the first frame in multiple layers? I am building a Photo Gallery app in order to learn flash and also end up with something useful. I started by making different layers for stuff like Static Variables/Global Variables, Initialization scripts, etc..., so I could have a better idea of where stuff is. Then I came to the realization if these layers run at the same time I will have alot of issues. So is it better just to have one Actionscript layer? or is there a way I can have multiple layers and still control in which order they run(also one layer's script running totally before the next one)?
-Dagon
Random With Exception - How To Do This
I made five buttons. They are invisble. One should fade in and out, then another one. The fading one is choosen randomly. Now how can i avoid that the same button fades in and out twice or three times consecutively.
Everything works fine the fading, the random selection, but not the last point.
Can anybody help me ?
Memory Exception
I have used swish for along time now im getting a memory exception with a hex number address when i try to start it up, what gives?
Random With Exception...
I would like to load a random swf...but not the one is just loaded!
mymovie=random(10);
loadMovieNum(mymovie+".swf",1);
and?
thanX a lot
Exception To Validation
Hello,
amazingly enough I have gotten this far and the rest is "simple"...i have this script (below) that validates the e-mail adress and sends it to an asp file...all I want to do is add a line somewhere proabably and else if command to the statment so if the adress is not validated but
ActionScript Code:
box.text = " THANK YOU";
than nothing hapens instead of showing the error message again...any suggestions...
thanks...
_DB
ActionScript Code:
on (release, keyPress "<Enter>") {
strEmail=box.text
var validated;
// we need to create a string
// with the value of the emailbox
trace("strEmail should equal " + strEmail);
var address = new String(strEmail);
// basic e-mail address validation
// makes them type at least 'a@b.c'
var at = address.indexOf("@");
var dot = address.lastIndexOf(".");
if ((address.length>4) && (at>0) && (dot>(at+1))) {
validated = true;
error.prevFrame();
trace("valid e-mail");
} else {
validated = false;
error.nextFrame();
trace("invalid e-mail");
// write some error about valid e-mails...
// the user deserves more than "nothing"
}
// if the e-mail address passed, send it to the ASP script...
if (validated) {
// create a new flash "loader" object
var loader = new LoadVars();
// the variable from the input text
loader.strEmail = strEmail;
// send the variable to the php script
// this can be any URL on the internet
// variables ("from" in our case)
// are delivered via the "post" method
loader.sendAndLoad("http://www.someplace.com/folder/folder/somefile.asp", loader, "POST");
// go to the thank you location
// (in this case the next frame
gotoAndPlay(2);
}}
File Not Found Exception
Can anyone tell me how to catch the above exception.
I am trying to set up a scenario where the XML connector component connects to a file called Products.xml, and if it doesn't find it, gives me an error message.
I have so far:
try {
XML1.trigger()
}
catch (FNF) {
}
Where XML1 is the XML Connector component.
Thanks
Dan
Exception Bubbling And Events
i have a try-catch statement that i want to use to load an image.
here is the stripped down functionality:
// actionscript
this.onLoadError = function() {
throw new Error("onLoadError");
};
mcloader = new MovieClipLoader();
mcloader.addListener(this);
try {
mcloader.loadClip("fdjk.jpg", createEmptyMovieClip("test_mc", 1));
} catch (e) {
trace('Error = ' + e)
}
// end actionscript
if the image doesn't load, i'd like to throw an error, but the onLoadError function is outside the scope of the try and therefore the throw will not find the catch.
is there ANY way to get something like this to work????
Exception Thrown By Getter
I'm working with a loader. Here's my code:
ActionScript Code:
import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.net.URLRequest;
private function loadPages():void{
if (counter < aPageLocations.length){
loader=new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, doneLoading);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errorLoading);
loader.load(new URLRequest(aPageLocations[counter]));
} else {
trace("FINISHED");
}
}
private function doneLoading(e:Event):void{
trace("LOADED");
var page:Page = Page(e.currentTarget.content);
aPages.push(page);
counter++;
loadPages();
}
private function errorLoading(e:Event):void{
trace("THE ERROR WAS CAUGHT");
}
The error handler never fires but when I try to assign e.currentTarget.content to my Page object i get a null error. When I debug I look in e.currentTarget.content and it says: <exception thrown by getter>
I tried using target instead of currentTarget but it is the exact same issue. There is nothing about this on the net. Does anyone know why this happens?
MovieClip Prototype Exception
I am extending the behavior of my movieclips by adding additional onRollover methods. This works well but the trouble is that I need to make exceptions. I would like some Movie clips to ignore the additions I'm making. The MCs that need this new method are created by duplicating a library Movieclip at runtime. How do I make this exception?
Memory Leak? Uncaught Exception? I Just Don't Know...
http://www.woodrosehomes.com/index.php
I have no idea why this is happening. If you leave this initial site open with the flash window/movie viewing gallery, you can click around a bit if you like. About 3 or 4 minutes later the .png dividers under "Recent Projects" will get a pixelated/color dodged white line around them. This is then followed about 30 seconds later by the actual thumbnails just completely disappearing. And then they'll randomly reappear a couple minutes later. And this cycle of appearing/disappearing thumbnails continues ad infinitum. There's no code executing to call this and I'm just completely and utterly confused as to why this would be happening?
Pictures of it below as well as the source code.
Any help to point me in the right direction would be greatly appreciated as this is the last thing I need to finish to close out this project. Thanks.
JSFL Exception Thrown W/ UpdateItem
I am getting the following exception when I attempt tor run a JSFL script in Flash 8:
Updating MyCustomComponent in library.
At line 68 of file "C:\appscrtlashBuildSupport.jsfl":
Exception thrown in native function.
The I get some output with the new component initializing. The code looks like this:
if ( curr_doc.library.selectItem( components[ i ].symbolName ) )
{
// Found item and was able to select it.
fl.trace( "Updating " + components[ i ].symbolName + " item in library." );
curr_doc.library.updateItem( env.FLASH_HOME + "/en/Configuration/Components/" + components[ i ].clipPath );
}
The line with the updateItem is what is failing. Normally when you update a library item in the IDE it pops up a dialog asking whether you want to "Replace" the component and I say yes. Obviously with a batch process that is not possible, but is that causing the exception to be thrown? Is there another way to update a custom component in a .fla. Should I try to update the instance on the stage instead? How do I select an item on the stage?
I am trying to automate the build process of our project which includes several Flash Movies, which are in turn built on a set of common components. The JSFL is called by Ant, which later on bundles everything up in a .war. This would save a lot of time if I could get it to work. Please help!!
Fred.
Camera.getCamera() Results In Exception
Hi,
I have a problem with Camera.names in AS3 using Flash Player 9.
Getting and displaying the content of Camera.names works fine.
But when I want to add the camera to my stage using Camera.getCamera(id), the player (or even my webbrowser when the swf is embedded) totally crashes.
I figured out that this problem only occurs when I select a Camera with the "Creative WebCam NX Pro (VFW)" driver, which is installed on my system. The corresponding camera is not in use any more. My active camera is a Logitech Quickcam.
The detailled error message is:
"Es wurde versucht, im geschützten Speicher zu lesen oder zu schreiben. Dies ist häufig ein Hinweis darauf, dass anderer Speicher beschädigt ist.
bei System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
bei Interop.ShockwaveFlashObjects.IShockwaveFlash.LoadMovie(Int32 layer, String url)
bei AxShockwaveFlashObjects.AxShockwaveFlash.LoadMovie(Int32 layer, String url)
bei FlashViewer.Controls.FlashView.set_MoviePath(String value)
bei FlashViewer.PluginMain.CreateDocument(String file)
bei FlashViewer.PluginMain.HandleCommand(DataEvent evnt)"
A translated version should be something like this:
Flash tried to read or write in protected memory. This could propably occur because other memory is broken/corrupt.
I don't know if this exception occurs with other drivers, but with this driver, it can be reproduced on any PC.
Even a try/catch block couldn't prevent the crash.
Does anyone know how to prevent/solve this problem?
Papervision3d Null Object Exception
hi,
i'm having some problems with getting the mouseRelease event from papervision3d 1.5
when i click the object i can get the reference to the object by the parameter passed to the function
private function handleMousePress(e:InteractiveScene3DEvent):void
{
var obj = e.displayObject3D;
obj.pick = true;
}
so, the object that i'm using is a custom class that extends the Plane class that has an attribute called pick (actually it is getter/setter method to acces the private attribute _pick)
so, for the MousePress Event, if i try to access the attribute direct from the e.displayObject3D it throws an error, but if i put it on a variable and then use the variable to reach the pick attribute, then i'm ok.
but for the MouseRelease event, it just doesn't work, it throws an error saying that there is a null reference to the object.
private function handleMouseRelease(e:InteractiveScene3DEvent):void
{
var obj = e.displayObject3D;
trace(obj.pick)
}
does anyone knows what's wrong?
Exception On RegisterFont With Seperate ApplicationDomain
I have a "Font Library" containing one font:
Code:
package {
import flash.display.Sprite;
public class Bogusflow extends Sprite {
[Embed(systemFont='Bogusflow', fontName='Bogusflow', fontStyle='normal',
fontWeight='normal',mimeType='application/x-font')]
public static var wrFont:Class;
}
}
I can load it from application "X" (an SWF file) as follows, with no errors or exceptions:
X:
Code:
private function InitApp():void {
var ldr:Loader= new Loader();
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, regfont);
ldr.load(new URLRequest("Bogusflow.swf"));
}
private function regfont(event:Event):void {
var Bogusflow:Class = Class(LoaderInfo(event.target).applicationDomain.
getDefinition("Bogusflow"));
Font.registerFont(Bogusflow.wrFont);
}
However, if I load application X from another application "Z" via SWFLoader, and I also specify a new LoaderContext, I get an exception in X when it tries to register the font (although the rest of X still loads).
Z:
Code:
private function InitApp():void {
var img:SWFLoader = new SWFLoader();
img.scaleContent = false;
img.autoLoad = false;
img.loaderContext =
new LoaderContext(false,new ApplicationDomain(null));
img.trustContent = true;
Application.application.addChild(img);
img.load("X.swf");
The exception currently is, "Cannot access a property or method of a null object reference", but at other times the error msg has referenced the font parameter of RegisterFont. The exception goes away if I comment out the new LoaderContext as defined (with the new ApplicationDomain), but I need to keep it in as I get other errors I don't understand when the ApplicationDomain is shared between X and Z.
I guess it will be a miracle if someone actually reads all this and knows what the solution is.
Exception To Error In Email Validator
Hello,
amazingly enough I have gotten this far and the rest is "simple"...i have this script (below) that validates the e-mail adress and sends it to an asp file...all I want to do is add a line somewhere proabably and else if command to the statment so if the adress is not validated but
ActionScript Code:
box.text = "________________THANK YOU";
than nothing hapens instead of showing the error message again...any suggestions...
thanks...
_DB
ActionScript Code:
on (release, keyPress "<Enter>") {
____ strEmail=box.text
____var validated;
____// we need to create a string
____// with the value of the emailbox
____trace("strEmail should equal__" + strEmail);
____var address = new String(strEmail);
____// basic e-mail address validation
____// makes them type at least 'a@b.c'
____var at = address.indexOf("@");
____var dot = address.lastIndexOf(".");
____if ((address.length>4) && (at>0) && (dot>(at+1))) {
________validated = true;
________error.prevFrame();
________trace("valid e-mail");
____} else {
________validated = false;
________error.nextFrame();
________trace("invalid e-mail");
________// write some error about valid e-mails...
________// the user deserves more than "nothing"
____}
____// if the e-mail address passed, send it to the ASP script...
____if (validated) {
________// create a new flash "loader" object
________var loader = new LoadVars();
________// the variable from the input text
________loader.strEmail = strEmail;
________// send the variable to the php script
________// this can be any URL on the internet
________// variables ("from" in our case)
________// are delivered via the "post" method
________loader.sendAndLoad("http://www.someplace.com/folder/folder/somefile.asp", loader, "POST");
________// go to the thank you location
________// (in this case the next frame
________gotoAndPlay(2);
[Flash 8] Gif Handling
Hello,
I'd like to know if anyone has tried to load gif images into flash 8? Is there a difference between how Flash MX handels jpg and how Flash 8 handles jpg/gif? Is it possible to use the LoadMovieClip class to monitor the progress?
Thanks in advance
Richard
[CS3] Catching/EventListener For PrintJob TimeOut Exception
I've been looking for a way to print a large amount of data with Flash. so far, It seems that the PrintJob methods don't seem to register right. How I read the docs was that you have 15 seconds between printJobObject.start() and the first printJobObject.addPage(), between the first printJobObject.addPage() and subsequent printJobObject.addPage(), and between the last printJobObject.addPage() and printJobObject.send(). But unfortunately for me, the way the timing appears to be working is this: time starts once the first printJObObject.addPage() and the last printJobObject.addPage(). the most pages I have been able to about put is about 45 pages of .jpg files that range from 50 to 130 kb, 579x749 px in size. If optimize the files any more, the quality becomes unacceptable.
So, I have been forced to accept that I can only spool 45 pages within the time limit, so I have a couple of other possible solutions. one is to have the option to print sections of the document. I don't really like this option, because as I have been testing my code, I am getting unpredictable behavior in that the # of pages spooled in not consistant, varying by about 15 pages, but never more that 45. I'm worried that this app will be running on a slower processor and the hard coding of the number of pages to print will also experience a variance in the number of pages spooled, and some pages will not be printed.
So, the option that I would prefer, is to run the printJob code in a loop, that keeps track of how many pages have been spooled, and will terminate once all the pages have been printed. What is happening now, is that the loop terminates once the timeout exception is called. I've tried using a try..catch..finally structure to catch the error and continue the loop, but a reading about this in Essential Actionscript 3.0 I have found that exceptions that are thrown by the flash player cannot be caught, and need to have and EventListener registered in order to manage the occurance of the exception. Does anyone have any ideas on how to do this? I've tried
Code:
addEventListener(TimerEvent.TIMER, testTimer);
addEventListener(TIMER_COMPLETE, testTimer);
printJobObject.addEventListener(TimerEvent.TIMER, testTimer);
printJobObject.addEventListener(TimerEvent.TIMER_COMPLETE, testTimer);
function testTimer(e:TimerEvent){
trace(e);
}
none of these would trace out the event object though, and I will probably continue to try other methods, but thought, wouldn't be cool if someone has been through this before and could offer some assistance?
I would appreciate any ideas, thoughts, or suggestions. Kirupa Rocks
Flash Handling Video?
Hey all, I am looking to be able to either load or stream video clips (30 seconds to 1 minute in length) from a flash site. I am wondering what the best options are for this in terms of video type (quicktime v. others) and how Flash might be able to handle the video. Can I stream it or is it best to just load it on the server somewhere? Any help would be awesome. Thanks to all of you who take your valuable time to help people out.
A
File Handling In Flash
Hello,
I am building a flash program that must be able to load an external file and save all the contents to a string variable.
How can I just do this? Do I need to use XML? I just want whatever is the best solution for this.
Jorge
File Handling In Flash
Can anyone tell me where I can find tutorial for reading and writing to a text file in flash possibly without using PHP or ASP?
Thanks
Handling Flash Files
Hi-
a collaborator just sent me an .fla file, as a sample to see if I can use files she creates. I'm on a Mac, with Illustrator, GoLive, iMovie, Quicktime, etc., and can't seem to get the file to do anything. I just downloaded the latest flash player. I even put it on a website page-- http://www.eatgoodbread.com/flashsample.html
Obviously I'm new to handling flash files, but shouldn't this just open with one of these applications?
Which leads me to the big question-- is it possible for someone to create Flash files (on a PC) and then hand them over to me, on a mac, so I can edit them all together in iMovie?
thanks very much for your thoughts.
File Handling In Flash
Hello,
I am building a flash program that must be able to load an external file and save all the contents to a string variable.
How can I just do this? Do I need to use XML? I just want whatever is the best solution for this.
Jorge
AS 2 Help With Handling The Flash Loadings
Hi all!
Im NikkiLoveGod ( somehow It didnt let me choose that one as my nick ) and im in serious need of help.
We are building a "small" application that lets you choose a house, one of its 4 view angles, and then change the colors of the roofs and yards and so on. We have done this, but it is VERY slow, and now we intend to build one that handles it alot smarter and faster.
I think I have a quite good idea of how I would interpret it in action, but not good enough
So, what I have.
I have to get the thing multilingual and easily traslated ( done with loadvars out of xml and php ) this is easy and fast.
Then I have 8 houses that user's can choose. When the user clicks a house, it opens it up and it loads a background image, and put pieces on top of it that are colored. Every house has 4 different angles to choose from. So 4 background images and 4 sets of pieces.
Now I have to make it so, that it is fast to use and load. This is my idea:
I have the 1st frame that is a "loading" bar that loads the multilingual text and the next frame which is the housechooser. When the 2nd frame with housechooser is loaded, go to it. Now the user chooses his/hers house and the flash keeps loading the other houses while the user is choosing.
Every house has a own frame and in that frame is a movieclip that contains the house and its angles. So 10 frames alltogether + inside the movieclips.
the thing is, that I want it to load these movieclips in the background, and when the user clicks a house, it checks if the movieclip that the house is in is loaded and if it is, it goes to it straight, but if it isn't, it STOPS the background loading, and starts to load the chosen movieclip. And when that one is loaded, go to it, and continue the background loading again.
These are precautions because there are quite a few pics and pieces you have to load and the filesize might get quite big.
So what I want to know is this:
Is this the most efficient way of doing it?
How on earth will I do this if it is?
By how do I do this, I mean that I dont know how to stop the loading. And how do I load the movieclips there efficiently. Should I make it like that the movieclips are in the library with linkage and then use attachmovie? Is attachmovie smaller / faster than moviecliploader and load external .swf?
Anyway, I hope you guys can give me some indepth of handling the loadings and so on.
Thanks a bunch mates! You can also contact me in my email ( sami.kurvinen [a t] gmail.com ), I'll reply to you immediately!.
File Handling In Flash
Is it possible to read, write and update files (like txt, pdf, doc, htm etc.) in Flash? I want user to put data in fields and then save the updated content (the content will be updated with new data, given by user) on their hard drive. The application is a Flash Projector.
Text Handling In Flash
I am a developer coming from Lingo, and fairly new to actionscript. I have two questions concerning text in Flash:
1. When you click on a dynamic text field, I want to trigger a function which detects the character, word or line of the text field. So far I didn't find any method covering this!
2. I'd like to place a dynamically created movieclip on my stage just after the last character of a text field. Is there a way to determine where this last character is?
thanks
Service Threw An Exception During Method Invocation: Null
Has anyone tried to do the "Hello World" test for Flash Remoting MX 2004 and ColdFusion 6.1? Thank's in advance for any assistance.
What this test has you do is
1) download the remoting components and install them -- here is the link: http://www.macromedia.com/devnet/mx/flashremoting/
2) create a .cfm file with a single line of code: <cfset flash.result = "Hello from ColdFusion MX!">
3) create a flash file with one dynamic text field in it
4) drag the remoting components on to the stage in the flash file
5) add some action script (that you copy from their documentation).
And when you compile the flash file into a .swf you are supposed to see the text "Hello from ColdFusion MX!" in the text field.
My text field says "service threw an exception during invocation: null"
I think I did everything they said to do, and I'm stumped. If anyone else can get this to work, I'd love to hear what you did.
Here is the link to the documentation
http://www.macromedia.com/support/do...lash_remoting/
Also, here is the NetConnection Debugger information I get when I see the error:
MethodName: "/1/onStatus"
ResponseURI: (undefined)
Parameters (object #2)
.....code: "SERVER.PROCESSING"
.....description: "Service threw an exception during method invocation: null"
.....details: "java.lang.NullPointerException
at coldfusion.runtime.TemplateClassLoader.findApplica tionCfm(TemplateClassLoader.java:82)
at coldfusion.filter.ApplicationFilter.invoke(Applica tionFilter.java:89)
at coldfusion.filter.FlashTemplateFilter.invoke(Flash TemplateFilter.java:37)
at coldfusion.filter.FlashFilter.invoke(FlashFilter.j ava:75)
at coldfusion.filter.LicenseFilter.invoke(LicenseFilt er.java:24)
at coldfusion.filter.ClientScopePersistenceFilter.inv oke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilt er.java:43)
at coldfusion.filter.DatasourceFilter.invoke(Datasour ceFilter.java:22)
at coldfusion.flash.FlashProxy.invokeTemplate(FlashPr oxy.java:103)
at flashgateway.adapter.coldfusion.ColdFusionAdapter. invokeFunction(ColdFusionAdapter.java:107)
at flashgateway.filter.AdapterFilter.invoke(AdapterFi lter.java:266)
at flashgateway.filter.SecurityFilter.invoke(Security Filter.java:85)
at flashgateway.filter.LicenseFilter.invoke(LicenseFi lter.java:58)
at flashgateway.filter.ErrorFilter.invoke(ErrorFilter .java:44)
at flashgateway.filter.LogFilter.invoke(LogFilter.jav a:43)
at flashgateway.filter.BatchProcessFilter.invoke(Batc hProcessFilter.java:63)
at flashgateway.filter.DebugFilter.invoke(DebugFilter .java:38)
at flashgateway.filter.SerializationFilter.invoke(Ser ializationFilter.java:59)
at flashgateway.Gateway.invoke(Gateway.java:194)
at flashgateway.controller.GatewayServlet.service(Gat ewayServlet.java:56)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:853)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker. java:91)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvok erChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequ estDispatcher.java:252)
at jrun.servlet.ServletEngineService.dispatch(Servlet EngineService.java:527)
at jrun.servlet.http.WebService.invokeRunnable(WebSer vice.java:168)
at jrunx.scheduler.ThreadPool$DownstreamMetrics.invok eRunnable(ThreadPool.java:348)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRu nnable(ThreadPool.java:451)
at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeR unnable(ThreadPool.java:294)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java :66)
"
.....level: "error"
.....type: "java.lang.NullPointerException"
|