ActionScript 2.0 :: Optimize Code For Several Buttons?

Sep 4, 2009

So I have 10 buttons, and I would like them to all do similar actions, but I was wondering if it's possible to optimize the code somehow.

When you rollover the button I would like it to alpha IN, and then when you rollout I'd like it to alpha OUT. Lastly, onPress I'd like to go to a different keyframe in the scene.[code]...

View 4 Replies


Similar Posts:


ActionScript 3.0 :: Optimize Code For 100 Swfs Or More?

Jan 13, 2011

How can I make this code smaller adding 100 swfs or more.

var seccion:String="home";
var loader:Loader = new Loader();
function loadSection():void {

[code]....

View 4 Replies

ActionScript 2.0 :: Optimize Last Section Of Code?

Sep 9, 2010

[code]...

This is all working fine. How can I further optimized the code (make it shorter) for last section?I created the loop for root.d and root.e of xml using for loop and while loop but then it does not add the xml values to the attachmovie text. I don�t know why?

View 5 Replies

Actionscript 2.0 :: Optimize Last Section Of The Code?

Sep 9, 2010

XML.onLoad = function(loaded) {
if (loaded) {
buttonArray = [b,b1,b2];

[code].....

View 1 Replies

ActionScript 3.0 :: Rewrite And Optimize This Ridicules Code?

Feb 9, 2010

How I can optimize this Script?Actually I wanted to have a textPlace that in click on new button, it fade out and fade in.I find out there are some simple way but at last i realized there are lots of problem.for example if I edited symbol txtPlace in itself or If I animate textPlace in main timeline.finaly, I create a loop of fade in and fade out in timeLine.but still for the first button I have problem!i decided to make firs button shown in stage!but there is no way to see that page again!

tamasBaMaSH.addEventListener(MouseEvent.CLICK,clickTAMAS);tamasBaMaSH.addEventListener(MouseEvent.ROLL_OVER,overTAMAS);tamasBaMaSH.addEventListener(MouseEvent.ROLL_OUT,outTAMAS);
function clickTAMAS(evt:Event):void{MovieClip(root).gotoAndPlay("out4");}function overTAMAS(evt:Event):void{   

[code].....

View 1 Replies

ActionScript 1/2 :: Shorten / Optimize Repetive, Long Code?

Sep 30, 2009

my code works, but is way too long, infact to get the result I want it would need to be very very long.Here is *some* of my code, this is for Left. I have 3 other similar bits of code for Up, Right and Down.

on (keyPress "<Left>") {  _root.player.gotoAndStop("left"); leftFunc = function () {  if (_root.player.hitL.hitTest(_root.everything.hitAll.hitLeft) || _root.player.hitL.hitTest(_root.everything.hitAll2.hitLeft) ||

[code].....

View 7 Replies

Java :: Referactoring Code In Php To Optimize Runtime Memory Usage?

Jul 22, 2010

I used to write programs in the android sdk for google phone. One of the android developers guide that I read says that it is more efficient to declare a const public static const NO:String = "no";

var1 == NO;
var2 = NO;
than to do this

[code].....

View 1 Replies

ActionScript 3.0 :: Optimize The Code And Make Some Kind Of Switch Case Inside The Function?

Aug 29, 2009

i have many buttons(they are actually movieclips) and for each i made separate listener function.. is it posible to optimize that code and make some kind of switch case inside the function. I don't know how to find out who called the function... is there way to find out. I don't want pass the additional argument with events because it wouldn't be optimization at all.I put only two buttons to reduce code:

Code:
button1.addEventListener(MouseEvent.CLICK, idi);
button2.addEventListener(MouseEvent.CLICK, idi2);
function idi(event:MouseEvent):void {[code]....

View 3 Replies

ActionScript 3.0 :: Optimize Script To Do Similar Activity For Various Buttons?

Apr 5, 2009

Iam having 3 buttons in stage and three corresponding movieclips. When I clicked on one button, it should play its corresponding movieclip from the second frame. (Same case for the rest of the buttons).Here the action for the three buttons are almost same, only the movieclip differs. In AS2, I can optimize the script for the above activity as below

for (var i = 1; i<=3; i++) {
_root["btn_"+i].onRelease = function() {
myname = this._name.split("_")[1];[code]..........

My Question is ===>is there any way to add the Event listeners for all the 3 buttons using "for loop" instead of initializing it for each buttons seperately ? [Imagine if we have more than 10 buttons and it will be very boring to add the listener for each button in a seperate line ].

View 2 Replies

Add A GetURL Code To The Buttons?

Jul 27, 2009

I have a pre built flash navigation menu. I am trying to add a getURL code to the buttons. The code looks like this:

function butnClick(event:MouseEvent):void {
if (event.target.num == 0) { // For the 1st button:
// Add your button click actions here[code]............

Im getting syntax errors and I know its wrong but thats the only way I know how to write it so far.

View 5 Replies

AS3 :: Code For Next- And Back-buttons

Mar 28, 2011

I am building a image presenter in Flash with as3 but i need a piece of code to make the two buttons work correctly. The code i have is as2 and i get 10 errors using it.[code]

View 3 Replies

ActionScript 3.0 :: Code For Buttons & Text?

Nov 17, 2009

I would like the code or links to the code to help me make buttons and plain text to navigates to various pages in a flash site.

View 1 Replies

ActionScript 3.0 :: How To Assign Code To Buttons

Sep 13, 2011

the current code I have on the timeline now (where the buttons reside) is:

stop();
function playLifeboy(event:MouseEvent):void
{

[code]......

View 9 Replies

Flex :: Declaring Buttons In Code?

Dec 23, 2010

How to declare the buttons in the following AS code What is the library that needs to be included

package
{
public class caml extends Sprite

[code].....

View 1 Replies

ActionScript 2.0 :: Accordion Code That Uses XML For The Buttons

Mar 10, 2010

I am using an accordion code that uses XML for the buttons. Here's an example of one of the buttons:

[Code]....

View 2 Replies

ActionScript 2.0 :: Next / Previous Buttons Code

Mar 27, 2010

Im trying to make a slide show with a next and previous button. I have name these two buttons next_button and previous_button.[code]

View 1 Replies

ActionScript 2.0 :: Get The Line Of Code To Run Without And Buttons?

Jun 1, 2005

We all know that you can make a frame lable in a movie clip and call it on press,rollOver ect...

_root.some_mc.gotoAndPlay("scene1") - won't play
on (press){
_root.some_mc.gotoAndPlay("scene1") - will play
}

My question is how to get the line of code to run without and buttons. I have made a few sites and never had to do this. I have tried making a function. But to no avail. I just want it to load when the frame reads the code..

View 12 Replies

IDE :: Buttons Inside Mc Affecting The Code?

Oct 27, 2009

I have this code that makes a menu with two buttons appear following the mouse when the mouse rolls over a movieClip:

Code:
var imgOptions:menuMC = new menuMC();
//Makes the image options follow the mouse
function showImgOptions (e:Event):void
{

[code]..

The problem is that the buttons are children of imgOptions, and when the mouse is over these two buttons, the movie reacts like the mouse is not over the imgOptions movieclip.

View 1 Replies

ActionScript 3.0 :: Baffled - Buttons Will And Will Not Work Using Same Code?

May 11, 2010

im using the following code:
 
stop();
btn_arrow_TL.addEventListener(MouseEvent.CLICK,l1top);
function l1top(l1:Event)
{
gotoAndPlay("left_flyout_play_1st");

[Code]...
 
The first two buttons (btn_arrow_TL and btn_arrow_RL) work... but btn_Home will not work.... it shows up just a few frames later in the timeline, but why would this have any effect on it working or not???  The ActionScript runs the whole length..

View 1 Replies

Professional :: How To Access A Buttons State With Code

Jul 28, 2011

I already made some buttons that I was planning on using as a menu for difficulty, easy,medium, hard. The buttons are already made with all the states and graphics, so I wanted to add an event listener so  that when you click a button for example easy, if the medium button was at its hit state I would revert it back to up, eg:easyButton.addEventListenere(MouseEvent.CLICK, function(e:event) { mediumButton.gotoAndStop("up") or mediumButton.up
 
but then I realized there is no propertie or function in the simpleButton class to change the state of the button,  I know I can make a movieclip, and do gotoAndStop at the up frame, but is there a way to make it work as a button???

View 7 Replies

ActionScript 3.0 :: Code A Menu With Buttons That Can Go Back ?

Apr 5, 2012

I have a project I've been working on that, when properly coded, has a "main menu" with 4 "doors" (buttons). When the corresponding buttons to these "doors" are clicked, it should go to and play an external .swf file.If that doesn't make sense, think of a DVD menu. You click play movie, it plays the movie. When the movie is over, there's two buttons on that swf file to either play the movie over or go back the main menu, which is an external .swf file (Remember, we go to the movie from the menu, which is a seperate file). So far, the buttons work. The menu works. However, from the movie, at the conclusion, when I click the button to go back to the main menu, it displays the movie clip and the buttons, but none of the buttons work. I'm starting to think it has to do with the fact the main menu was written in AS3 and the movie was made in AS2. If anyone can assist me in being to able to keep both files and still navigate between the two, being able to bring up the menu from the movie and be able to play the movie again, and so on and so on. Here's the code for main menu, which I guess acts as the parent file, and the movie. If I get this to work, I essentially would duplicate the same actions for the other 4 doors, once I complete the environments for them.

Main.Fla/Swf (written in AS3)

(This is the action on the first frame, that has all the buttons. For this question, I'm just trying to properly code for 'Door4', which is the "door" to the movie.)

import flash.display.Loader;
 stop();
 var myLoader1:Loader=new Loader ();[code].....

View 6 Replies

Flash 9 :: CS3 - Attach Simple Code To Buttons

Sep 8, 2008

Say I have a symbol MyButton, as a button with the 4 special frames. When you mouse-over/mouse-out an instance, I'd like another object to be affected... text in some text box changing, or the item becoming visible, or similar. I know AS3 but I'm a real noob at CS3. I don't really get how actions work in CS3.

View 5 Replies

ActionScript 2.0 :: Previous/Next Buttons - Write Code?

Aug 7, 2009

Is it possible to write code that so when you hit a "next" button, it tells a movie clip to move so far each time it is hit? Same as with the "prev" button moving the opposite way.

View 1 Replies

ActionScript 2.0 :: Code Generates Buttons (MC's Actually) Which Get A Name And A Url From A XML File?

Apr 16, 2010

This code generates buttons (MC's actually) which get a name and a url from a XML file. The problem is that the url assigned to the buttons is the same for all buttons, namely the last entry of the XML file. I can't seem to figure it out.Here's the XML file:

Code:
<buttons>
<button title="Google">http://www.google.be</button>

[code].....

View 3 Replies

ActionScript 2.0 :: How To Code Advanced Buttons Property

Jul 26, 2006

I have a navigation bar with a series of buttons on it. When you rollover any other these buttons there is and action on them saying :

on (rollOver) {
this.gotoAndPlay("over");
}
on (rollOut) {

[code]....

Now I want to create some AS that when a button is click and disabled and then the user clicks on another button all buttons will reset themselves and play "out" if they were previously clicked (enabled=false)So in the end I am just looking to say "Hey flash if a button 1 is clicked and disbaled and then button 2 is click then button 1 needs to enabled itself and play "out".

View 13 Replies

IDE :: Get Code To Use Buttons To Stop The XML Working While Going To Another Frame?

Jan 12, 2009

Now I'm working on a Website which contains a XML Carousel Gallery, with the coding below.Now this all happens on the homepage. I would like to stop the xml on other frames though. Is there any coding I can use on my Buttons, to stop the XML working while going to another frame?

stop();
var folder:String = "thumbnails/";// a folder for thumbnail files + an XML file
var total:Number;
var radiusX:Number =180;
var radiusY:Number = 10;

[code]...

View 2 Replies

ActionScript 3.0 :: Flash 2 Buttons Wrong Code

May 6, 2011

Im currently trying to code the Login and Register buttons on the main screen of an app prototype to lead to certain frames.The code im using is below, i know this will be an easy fix for most of you,a compile error stating that it expects 2 arguments is coming up.[code]

View 2 Replies

ActionScript 3.0 :: Code To Link Webpages With Specific Buttons?

Feb 15, 2010

What I need is a code that sends the user to a speacific page, everytime that button is clicked. The way I have been trying to do this (which may be wrong) is to set up each page on a different keyframe in the timeline (with stop actions on each one) - surely its now just a matter of adding an action to link each button to their page?

View 2 Replies

ActionScript 3.0 :: Code Snippets Buttons - Syntax Error

Sep 19, 2011

Hi, whenever I click on my code snippets button in Flash Pro, the output panel gives me a message about a missing bracket at the end of an argument list. In addition, none of the code snippets work. How might I correct it?

View 1 Replies

ActionScript 3.0 :: Code To Support Swf Player With Control Buttons?

Oct 20, 2011

i need code for swf player.the player consists of play, pause ,stop, next and previous with seek bar and time control.i had try my code which not support my swf ......the code is

function swfLoadedHandler(e:Event):void {
trace("swf loaded");
currentSWF=MovieClip(swfLoader.content);

[code]......

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved