ActionScript 3.0 :: Box Creation - Correct Way For Checking Error?
Aug 12, 2009
I'm just wondering if this is the "right" way to do the error catching. I have a program that creates a random number of squares (up to 25), but no more, and usually less (like I said, random number). Due to the fact that there's a random number of them, I create an array ahead of time. Only some of the squares in the array get used, and the others sit there and aren't added to the stage. Anyways, at the end of the box creation, the program goes back through and deletes all of the boxes in a loop:
Code:
for(var i:uint = 0; i < boxArray.length; i++){
try{
removeChild(boxArray[i]);
}catch(e:Error){}}
It seems to work okay, but I just want to know if this is the correct way to check for errors. If I put a trace in the catch block, it catches the squares that aren't in the display list, obviously, because they aren't there to remove.
View 1 Replies
Similar Posts:
Aug 25, 2011
I am working on a game in flex, and I am trying to create an xml file for each user if it is their first use, and then after that just access that file and edit it accordingly.Is there anything that could do this same thing first off, basically create and edit some sort of save state? I assume that flex would have some kind of saving state type of thing, but I am not sure what to look for in that respect.If not, does anyone know how to do this with xml files?
View 1 Replies
Jul 24, 2009
I'm working on a quiz where a user has to drag three movie clips to correct positions then press the 'next'button to move on (calls funtion nxt).I have nxt function to check to see if the three movie clips have been dragged onto the three correct positions (other movieclips),the code works but only if all three are correct.I want the function to check to see if all the clips have hit the right target,
if so, then add +1 to the 'score' and go to frame 'end'
if the clips aren't on the right target then just go to frame 'end'
At the moment the nxt function doesn't work if the answers are wrong.
function nxt(event:MouseEvent):void
{
if (asc1_mc.hitTestObject(blank1_mc))[code]...........
View 3 Replies
Feb 24, 2011
I am after finding out which drag and drops are correct, so I can score accordingly rather than just have a single score throughout. I need to know if the circle was dropped correctly or the square etc. I'd ideally like to have this interaction as a command on a button, but my AS3 is letting me down
var score:Number = 0;
var startX:Number;
var startY:Number;
[code]......
View 5 Replies
Nov 9, 2011
This is my code currently it checks a csv document to display correct advert. Projector keeps on crashing
ActionScript Code:
//import controls
import flash.events.Event;
import fl.containers.UILoader;
import flash.net.URLLoader;
import flash.net.URLRequest;
[Code] .....
Need to refine code, I thought maybe using a Loader instead of the UILoader so that I could use the unloadAndStop command to release memory leaks.
View 6 Replies
Jan 30, 2007
The thing I want is like I will have a input text field for someone to type his email address, but after he presses the send button I want it to check that input field and see if there is the "@" and the "." symbol available in the field or no.
View 11 Replies
Mar 17, 2009
I am working with CS3. yesterday I have finished my Website without an error message. Today I wanted to work again but I had this message error :
"Error during the creation of the file of the Flash animation. To check that the file of destination is not in reading alone or is not already used by another application. Also check that the name of the file is not too long."
View 12 Replies
Apr 21, 2009
The problem I've found that I keep having and that is pretty recurring between a few of my classes is that several classes use addEventListeners for complete events on loaders, tweens, etc. The question I have is, how do I catch those events in the event that the instantiated class object is removed from the swf file? Because the eventListener keeps listening, for some reason(I assume the object is removed from the stage but garbage collector doesn't get it right away).
My current, most prominent example is this:I have a photo album that utilizes php to import filepaths on the server. There are basically 2 stages: one screen where all the albums are displayed, and another screen where all the images for a given selected album are displayed.
The problem is that when you click one of the albums, it loads all the images from that album and THEN transitions to the viewing page. This is good because it doesn't load all the images from all the albums.
The problem is, it's possible for the user to click one album, and really quickly, before the "album" page fades out, click another album.
If I've managed to not twist your brain inside out with this poor explanation, you may see that the loader object for the previously clicked "album" button will still be loading the one of the previous images. So, when the complete event for the loader is fired, I get this:
Error #2044: Unhandled IOErrorEvent:. text=Error #2124: Loaded file is an unknown type.
Which I assume, obviously, is 2 separate error events. I'm already using error catching that's working for another purpose, but I just can't catch these ones no matter where I put my catch statements. Any help?
Here's the code:
Code:
function clickHandler(event:MouseEvent):void
{
//////some stuff here
////////preps album images for display
[code]....
The first type error gets caught. It loops back through and works fine when you only click one button at a time, but otherwise it freaks out. I just don't know where to put the catch statement so that it just shuts up...
View 17 Replies
Aug 6, 2009
Is there any way to have flash give an error line number? I get errors, but it takes forever to find out where they are taking place unless I put a "trace(start function X" "trace(end function X" everywhere. just having a random error somewhere in all the files? It tells me which function it hit the error, but in visual studio you could trace it back, so I can see where in the program it's being called....
View 2 Replies
May 24, 2010
Just wondering where I find a list of what can be error checked in input text fields?I'm looking for things like...- checking that letters and not numbers are entered- checking that an entered number is in a certain range
View 2 Replies
Nov 6, 2010
I have a slideshow (graphicsshow_mc) within a navigation menu (graphicsmenu_mc) - a movieclip nested in a movieclip. There are previous / next buttons inside the slideshow that work correctly.
Example: prev_btn02.addEventListener(MouseEvent.CLICK, navBack02);function navBack02(event:MouseEvent):void { gotoAndStop("deinonychus")}
The navigation menu acts like chapters for a DVD, and I want one button to always go to the beginning. I copied the other code, but need it modified to reflect that it appears in the parent.
[Code]...
View 7 Replies
Dec 23, 2009
trying to automate the error checking process for a form before sending it to the server.
an array holds all the parameter names of the input text component (default GUI components shipped with flash).
trying to loop through the array: the following happens: var test2 traces out the correct x value of the input field var test1 traces out nothing.
so actionscript recognizes the input field but i can not read out the value of .text
[Code]....
View 0 Replies
Jan 13, 2010
In Actionscript 3, I'm trying to build a button to go back from a content frame to a main menu. When the button is clicked, IF the content frame has a movie in it, that movie should stop playing. Flash keeps throwing a "null object reference" error on all pages that don't include a movie. I even tried putting in a check to see if the movie exists, but that doesn't work, either.
ActionScript Code:
function return_to_menu( me:MouseEvent ):void {
if ( flashmo_contents.flv_movie ) { //this line produces errors in frames where the movie
[code]....
View 2 Replies
May 3, 2011
I have a drag and drop SWF. What I want to happen is when they drag a certain shape to the correct spot, some text displays depending on what shape they dragged across but I have this error come up. Can any one tell me how to fix it ??
[Code]....
View 9 Replies
Jul 2, 2009
I have text input boxes. There is validation for each of the boxes using numberValidator. Now, the thing is that am using alert box to show if any error occurs.
Flowchart ::
1> Insert value in textBox.
2> NumberValidator validates the input on "trigger=change".
3> If error, alert message is displayed. The user clicks OK to go back to form.
4> Focus set back to the TextBox.
5> But, alert box makes the text input value blank / null. i.e. Both the previous error value entered by user and the default correct value will not be displayed now.
Display the most recent correct value that was entered in the text box. Not the default of any other, but the most recent correct value entered by the user.
View 3 Replies
Dec 30, 2009
I'm trying to get the depths of all the blocks to be at the correct levels at the correct times so that the 3d effect is maintained. I've tried many things, but have had little success. All the instances of the blocks are stored in an array, but since it's adding them in accordance with when they're added to the stage, it doesn't help me locate them to swap depths. Is there a way to arrange them by location on the board?
View 4 Replies
Mar 5, 2011
at some point in the past, i believe soon after i got Flash CS5 and installed it, i started receiving the following error when clicking the "Check Syntax" button:
Warning: 5004: The file '/Applications/Adobe Flash CS5/Common/Configuration/ActionScript 3.0/FP9/playerglobal.swc', which is required for typechecking ActionScript 3.0, could not be found. You may need to reinstall Flash.
what's particularly annoying is that playerglobal.swc file is present in that FP9 directory. do i need to choose some arbitrary setting somewhere so Flash CS5 knows it's not 2008 and that i'm not deploying on Flash Player 9?
View 14 Replies
Feb 2, 2010
I want to make a flash application in which i will load 3-4 different mp3 files of different instrumental music. After loading it I want play all files. Further I want to save or create a merged mp3, from all mp3s sound files in a single mp3 file.
Is it possible to convert different mp3 sound track in to different ByteArray and later using any other technology like PHP or C# can we merge all byteArray in a single byteArray to create a single mp3 file.
So that we can listen all instrument playing in a single mp3 file.
View 8 Replies
Aug 29, 2009
I am building an ambitious site especially for someone new to the Flash.I want to create a fully functional Flash Forum.Only problem is I have not found 1 site with information on how to build one and the only thing I did find was something called the Flash Forum Engine. It is a 3rd party software suite that allows you to build a Flash Forum BUT! it costs 1000 Euro's or $2000.
View 4 Replies
Feb 21, 2010
I'm having a hard time creating a Flash using Flash 5. The first loop asks for a number of participants. The next loop, you select or enter the name of the beverages available. The third, and more complicated loop - Up to 4 randomly selected beverages are selected and a percentage (for mixing) are provided. For example;
[Code]...
View 2 Replies
Jul 12, 2010
I have a project of dynamic banner creation. The main part of the job is creating a swf on clicking on a "publish" button on stage. A certain movieclip of any width and height on stage must be exported as a new swf file.
View 4 Replies
Mar 7, 2012
I am considering using flash for a kiosk project together with Visual Basic. I need to create simple SWF file with some buttons and background image, and maybe play some movie clips. Could you kindly suggest free tools for that purpose.
If there are not free tools for that, what is the normal commercial enviroment use?
View 2 Replies
Sep 12, 2009
When you make a movie clip, and have it open, does it have a physical 'place' on your pasteboard or main timeline?
For instance, when I test my 'scene' (as opposed to movie) my clip will be out of whack and off to the side of my movie viewer.
Then when I place the clip in my main timeline, i have to monkey around with it to get it to line up. I get a circle and a blue line at the top, but not sure what that space corresponds to.
Is there a good tut out there for movie clip creation and placement? It feels really sloppy the way Im doing it.
View 1 Replies
Feb 23, 2010
I'm somewhat of a noob here, so please forgive my ignorance. I tried to google the answer to my questions, but probably not using the right terms.
So my questions are these: Is there any advantage to using vector elements in flash projects, or do they just get rasterized in the swf creation process?
If you use vector instead of raster art, can you scale your swf infinitely large (theoretically) without degradation? Will vector art result in a smaller swf size? Will it take less processing power to play?
View 1 Replies
Apr 29, 2010
I don't know whether its the right place to post this question, I am trying to create a guest book in Flash.
View 1 Replies
Dec 23, 2009
I'd like to learn how to create a java web service that can be consumed by a web tier, which is constituted of java and flex. What books can help me learn how to create a java web service and consume it via java & flex?Should I look to build a web service from scratch or from frameworks like: XFire, Axis, CXF, Spring Web Services, etc.?If using a framework is recommended, which of the above or any others makes the most sense to learn/use?
EDIT:Both the java AND flex components of the web tier need to independently access the web service. For example, the flex component helps the user create & save a spreadsheet; the java component retrieves the spreadsheet data and displays it accordingly.
View 4 Replies
Jul 11, 2011
My goal is to make a flash/as3 program that would pull multiple sets of data (images and texts) from the database and compile and save a flash video project for each one. What might be the best way to go about making this work? I checked but wasn't able to find a function that would publish the flash project in it's current state, so I don't think I can execute the entire process in a single flash/as3 file. My only other option is to have some other program/batch file take care of the querying the database and compiling multiple flash/as3 movies by starting up a flash program and passing it the parameters of the data it needs to build 1 complete project for 1 set of data. Is there a program to create .swf files automatically? Is it even possible to pass in init params to flash/as3 project?
View 1 Replies
Sep 27, 2011
My problem is i am trying to make a panel. My button in in Main.mxml whereas the panel functions are defined in panel_Create.mxml. the code works fine. In panel_Create their are functions to create panels at runtime. The problem i am facing is when i run the program it wont show the panels but it does increase the value of n and after 8 clicks it gives alert message. The code works fine when i put all the code in Main.mxml
<fx:Script>
<![CDATA[
import Components.panel_Create;[code].....
View 3 Replies
Apr 4, 2010
I have Flash 2004 MX (Educational Version), and I'm trying to get an flv player for my flv in my library to work with a play button (when the vid ends, it should automatically have the code written so that it will pop back to the start (if possible). I was coached a bit that I need to use the Netstream thing (as 2004 doesn't have the mediacomponent) and so far I've put the 'New Video' object onto my stage and created my own play button. (the video also shouldn't automatically play but should be sitting there 'ready to play' until someone clicks the play button.) Also, of importance, is that I have a timeline with a loop of animation that should be able to keep looping endlessly even though this video i'm wanting to stream is longer than the looped animation, so if someone plays the video, the animation loop should still keep animating/going even as the video is played or stopped, etc. In other words, the video should have it's own timeline apart from the animation's timeline. Unfortunately, I'm a newb with code and have no idea to get the video into the object or how to have the play button work with it, etc.
View 8 Replies
Mar 2, 2005
I have this code
Code:
_root.bottombar1.attachMovie("home_btn", "home1",1000);
_root.bottombar1.home1.dtxt.text = "Home";
[code]........
View 6 Replies