Actionscript 3 :: Function Compressing Re-usable Code?
Jan 13, 2012
In my quest to learn ActionScript 3.0 I have stumbled across another situation where I know what I need to do, but just can't figure out how to do. I have written code to animate a menu with 3 buttons. These 3 buttons reside in a seperate class file known as MenuButtons.as and I am animating them within my Main.as file which builds the application and places the relevant details onto the stage.So in my Main.as file I have written the animation code that I would like to use to animate the buttons. Whenever a button is clicked, an event is dispatched which a handler listeners for then executes the relevant function. So the function for animating my 3 buttons looks like this (bear in mind that the buttons are arranged in a place holder in MenuButtons.as which in turn is loaded in a new MovieClip in the Main.as file)[code]I also tween the logo from here too. It works fine which is great, but is there a way I can make this code more simpler? I may not be able to and I have tried to find my answer online but alas I cannot find what I am looking for.
I am loving how I am learning something new each day and by building up slowly I am learning more functionality and broadening my knowledge of ActionScript (although some of it is very confusing!)Is there any good websites out there that can help? I have a subscription with Lynda.com but i find that their explanations can sometimes be hard to understand. I love text based tutorials where I can follow at my own pace.
View 1 Replies
Similar Posts:
Mar 25, 2009
I am working on a presentation that has multiple scenes each having say 100 frames. Every 10 frames there is content on the stage, i.e. a 'slide'. There are left and right arrow buttons to take the user of the presentation forward and backward - much like a powerpoint presentation.Many of the 'slides' contain another button (instance name infoBTN) that can be rolled-over, and when this happens an info bubble pops up to display some information in the form of a graphic (instance name infoBubble).This operation works fine for one button, but I don't really want to have to call a new function and variable name and have new instance names on each subsequent frame that features a similar button with an identical operation.
how can I call the function just once and re-use it over and over again? There will only ever be one button of this nature on a given frame,This is the working code I have on the timeline for this particular frame:
Code:
// INFO BUTTON MOUSE EVENT
var fadeIn:Tween = new Tween(infoBubble, 'alpha', Regular.easeOut, 0, 1, 0.75, true);
[code]........
View 9 Replies
Jul 19, 2006
I am new to programming (have mostly worked with ASP.Net) and have been trying to compress a string in C# and decompress it in ActionScript for quite some time now. Was Successful with Zlib but need another implementation for the same using a different Compression Algorithm.ut i get an error where it says that the input is not in gzip format.i am also trying to use LZW Compression with no success in compressing in LZW in C#.so have not tried LZW Decompression in ActionScript Either.So .... i.m stuck at : I need to compress a string in C# and Decompress it in ActionScript using a compression Method other than ZLib.
View 5 Replies
Sep 2, 2010
My flash movie is 73.6 kb I would like to make it a smaller file size, but when I compress it to a lower quality in publish settings, nothing happens. I also tried lowering the jpg quality but also, nothing happenend. It stayed the same 73.6 kb
View 2 Replies
Nov 19, 2009
when i view my flash file in firefox 3.5.5, it compresses my flash movie smaller and quality looks pretty bad. In Safari, it is fine. I tried publishing as "exact pixels" instead of match movie and set scale at exact fit.
update: now firefox is cropping my flash movie....but safari looks fine
View 1 Replies
Mar 27, 2012
is anybody here who have and would be willing to send me png2atf tool for compressing textures? It was part of the prerelease of Adobe about a year ago.
View 0 Replies
Aug 5, 2010
I have an array of BitmapData and I want to make a FLV video out of it. The problem is that "raw" video takes a lot of space. How do I make compression of such data in actionscript 3?
View 2 Replies
May 18, 2009
I need to make a tool (in flash) that people who do NOT have flash can use to create some artwork (graphs and lines at particular angels in particular) and then export the artwork in a format that designers who DO have flash can use in flash for animations. We're trying to cut out a step where our content folks give our designers graphs that need to be hand traced in Flash. Are there any third party plugins that would allow a swf to generate and EPS, AI, or FLA perhaps?
View 1 Replies
Jun 10, 2009
I am trying to replace some code which loaded an external image and triggered and function once completed with code that uses and embedded image. The relevant code looks like this.
Code:
[Embed(source='globe.png')]
public function Globe()
{
var imageLoader:Loader = new Loader();
[code]....
The commented out section is where it used to take the loaded image and apply it to a texturemap.I need to replace the lines of code in the first function with something that calls the second function correctly.
I have tried using function imageLoadComplete (e:Event = null)and calling it with imageLoadComplete(); in the first function but although it compile and runs without error, the program does not work properly. I suspect this is to do with the dispatchEvent(); line which I do not understand.
View 4 Replies
Jun 10, 2011
So here I have a code which gives a feedback after the code is copied to clipboard ,but after someone use it once it stop working.
[Code]...
View 8 Replies
Jan 13, 2010
How do I turn a value into something i can use without the "-" negative value if there is one.
I have an "imageLoaderHost" movieclip and I need it's x position to be usable wherever its at. for instance:
if imageLoaderHost is at -1258(x position), I need "b1" to go to 1258 (without the "-" as you can see).
View 2 Replies
Jun 22, 2009
I would like to be able to create a set of standard text animations for different length bulleted lists, headings etc and then feed these animations (probably with xml?) to create unique mc's.
View 2 Replies
Dec 19, 2011
I'm trying to make a tile-based AS3 game that uses PNG images as the base for maps that loads them from the library and converts the data to an array with each pixel of data being an individual tile. Essentially, if I had a 128x128 pixel PNG with say, green pixels being converted to "GRASS" in my array, I could then cycle through the array and add tiles to the map movieclip accordingly. I've looked at the ByteArray class and I can't seem to decode the data into a usable format.
View 1 Replies
Jan 8, 2008
im trying to check time, but check to see if the time is within a range.
for example, check to see if time is between 12:50pm, and 30 minutes later (1:20pm)
also, i want to be able to calculate that difference (12:50 + :30 = 1:20)
and also how to hande getting the time range? ie. (currentTime >12:50 && currentTime < 1:20)
View 8 Replies
Mar 11, 2008
Within a script, I move to a keyframe where a movie clip exists. The movie clip is attached to an Actionscript 2.0 class. Once the movie clip exists, I want to be able to give it some initialization settings, but it seems they are not available until the next frame. For example, let's say in a script I say:
[Code]...
View 1 Replies
Feb 19, 2009
I've got a .txt file hosted on a freewebs, which my actionscript gets some variables for (for easy updating of statistics).
I want to do be able to do math in actionscript with these numbers I'm calling up from the .txt file, but the problem is that when I call up the variables, they are recognized as a string, instead of integers.
How would I convert the string to an integer in actionscript, or write the number in the .txt so that it's recognized as an integer.
View 2 Replies
Aug 2, 2009
in this site we of course need to to display non-latin characters like etc.we decided to go for the Minion Font (on Mac) because it includes all possible Glyphs.no i embedded the font on the library and used it via menuitem_font =new Minion()but the special characters are still not displayed.also when i do trace(menuitem_font.hasGlyph)i get "false"
View 3 Replies
Nov 13, 2010
How could one set up a movie clip that has usable buttons in it? If i understand correctly, the movieclips actions will override all the button actions...? For the purposes of my project, I need a MC that ive set up to loop across the screen with my buttons on it.
View 3 Replies
Jun 29, 2009
got past the last problem i had. now i have a series of bitmaps stored in an array... actual bitmap data, not external image references..
View 1 Replies
Sep 14, 2011
I am creating multiple bitmaps within a loop, and placing them inside their own MovieClip. I then have another MovieClip in the Library which I am calling and putting inside the MovieClip generated for the bitmap. Alas I cannot get multiple instances to work of the MovieClip from the Library. I think it must be my syntax in the following code..
Code:
for(i=0;i<10;i++){
this['bmp'+i] = new BitmapData(etc,etc)
this['box'+i] = new Bitmap( this['bmp'+i] );
[Code]....
View 1 Replies
Jul 12, 2011
Im character rigging so im making nested symbols.i was wondering how do i take these nested symbols and create a re-usable symbol library and import these into different files for use.
View 4 Replies
Mar 29, 2011
We can auto-generate flex-confix xml file from flash-builder so to provide users that want to compile project on there own would be capable of doing such thing with out buying FB. So we use something like -dump-config slotConfig.xml as flex compiler argment. This generates a file for us... with lots of detailed comments like this one I generated from that project:
<flex-config>
<!-- benchmark: output performance benchmark-->
<!-- benchmark usage:
[Code]....
View 1 Replies
Sep 18, 2008
I'm trying to compress a video into an flv for my flash file. When I compress the video using flash video encoder the video shows up white but I can see the audio. The original version is compressed using H.264. I don't know enough about codecs to know why its not showing video.
View 1 Replies
Nov 8, 2010
I am gonna connect two swf file on the same domain. I actually want to connect button1 on swf1 to frame1 on swf2 and then the same like that button2 to frame2... I think localconnection class is usable for that I am open to other ideas, it's very simple I guess but I am novice at this and this is my first job.
View 1 Replies
May 3, 2010
I've created a servlet that changes the binaries of a SWF file and output it to the user. The SWF is compressed by ZLIB by default. Then I inflate, change the binaries, deflate and output the result.
Everything was running right on a Windows Server 2008 (also in 2003). Currently, we need change the server to Linux, and then, this servlet is somehow outputing a corrupted SWF File... what could be the problem? What intrigues me more is that there is no difference between the Windows and Linux servlet versions.
Is there any undocumented linux specific behaviour for the java.util.zip package?
[Code]...
View 1 Replies
Aug 6, 2009
I have been searching the internet for help on how to delay code within a single function, but every solution I have found so far relies on creating event listeners for a timer and then running commands from the event handler functions.I am writing a 'console' type interface where the user types in a string which is, upon pressing enter, processed in one function and then sent to a final function to display the result.[code]I want to somehow insert a pause between each call of that last function, updateDisplay.
View 1 Replies
Jan 11, 2010
In the moveThings function, the if part is only ment to play if the cursor is over the circle (ball_mc), which follows a bit after the cursor. However, something is wrong that makes it play this part (the first if statement in the moveThings), while it's meant to play the else part in that function unless the cursor is over the circle in which case the if is true.So what is wrong? I'm assuming that it's something with
Code:
if(-20 <= (stage.mouseX - ball_mc.x) <= 20 && -20 <= (stage.mouseY - ball_mc.y) <= 20)
that makes the computer play that statement even though the cursor isn't over the circle.
View 3 Replies
Jan 3, 2011
I have unfinished code I'm working on. It has a listener event and a function. I notice when I put the for loop outside the function (it would be below the last line) it doesnt execute. Why doesnt the code I type outside of the function execute? I need to know for future reference
[Code]...
View 4 Replies
Oct 19, 2009
I have a project which uses very similar code for I think 12 or 13 different movieclips. I actually copy-pasted a good chunk of the code changing words and numbers here and there.[code]The main point of this part of the project is that each movieclip is a selector on a scrollbar. I just wanted the selectors to look nice, so they tween up and down on rollover and when they are clicked they change from black and white to color. Also when clicked they move a very long movie clip called customizing_forms_mc, into view on the stage. The code is inside a movieclip that contains all the selectors. There is a layer for each selector and on that layer is the code for that selector. I was thinking that there might be a way to call a fuction perhaps with the variables that are brought to the function being strings that i could substitute in for the names of the movieclips. I tried attatching the fla or an swf but they are both too large. For a more detailed look at the code on the stage:[code]As I previously said there is a scroller with the selector buttons and when clicked they bring a certain part of another movieclip into view. Of course, everything is masked so it looks nice.
View 1 Replies
Dec 21, 2011
Say I need to know if a movieclip is draggable (for reasons of changing a custom cursor to an appropriate graphic).
I can check if that movieclip has a function assigned to it's onPress event.I store the assigned function in a Function object variable.
Can I see what code is inside this Function object? If it contains a "startDrag()" or "stopDrag()" method?
View 1 Replies