ActionScript 2.0 :: For Loop OnRelease Function?

Jul 14, 2010

I am designing and coding a navigation menu at the moment, and so far I have got the button instances to duplicate for each of the menu items, and set widths, positioning values and RollOver/RollOut functions. However, I would ideally like to include the onRelease button functions in the for loop too - as they are all the same apart from the variable "i". Here is the code snippet:

ActionScript Code:
for (i=1;i<(_root.noofmenuitems+1);i++){
duplicateMovieClip("mc", "mc"+i, i);

[code]...

Now my problem is that by the time the onRelease function is called, the for loop has been completed and the value of i returned is the last i value from the loop (_root.noofmenuitems+1). The this["mc"+i] part obviously works, because the trace function is called when I click any of the menu items.The problem is that I have 6 menu items, and when I click any of them, the trace function returns "test 7" - not the corresponding i values for each button.

View 9 Replies


Similar Posts:


ActionScript 2.0 :: CreatEmptyMovieClip() With OnRelease() Function Via A Loop

Oct 7, 2009

I'm trying to display thumbnails with a for loop but i would like that each thumbnail have an onrelease action.

here is my scriptnote: i use trace() for look if my loop works aswith the onrelease function)

HTML Code:
var posX = 163;//1st position
var posY = 103;//1st position
var Dec = 0;// var for the space between thumbnails set to 0

[Code].,...

View 3 Replies

ActionScript 2.0 :: For Loop OnRelease Function [Flash CS3]

Jul 14, 2010

I have another question about my For loop. I am designing and coding a navigation menu at the moment, and so far I have got the button instances to duplicate for each of the menu items, and set widths, positioning values and RollOver/RollOut functions. However, I would ideally like to include the onRelease button functions in the for loop too - as they are all the same apart from the variable "i". Here is the code snippet:

[Code]...

View 2 Replies

ActionScript 2.0 :: Loop Through An Array Of Mc's, And Assign Each A OnRelease Function?

May 19, 2009

I want to loop through an array of mc's, and assign each a onRelease function. I have the following code but the trace inside the function doesn't seem to find the array.I understand why but what is the correct way of doing this?

ActionScript Code:
var theArray:Array = new Array();
var j:Array = new Array();[code].......

View 1 Replies

ActionScript 2.0 :: Why Can't Add Btn.onRelease In A Loop

Aug 31, 2006

I'm tring to add a onRelease event into every button I have, code like

for(var i = 1; i <= totalPage; i++){
_root['button'+i].onRelease = function(){gotoPage(i-1)};
}

why its doesnt work. I have to do like following

button1.onRelease = function(){gotoPage(0)};
button2.onRelease = function(){gotoPage(1)};
button3.onRelease = function(){gotoPage(2)};

[Code].....

View 5 Replies

ActionScript 2.0 :: OnRelease Not Working Within XML For Loop

Jun 30, 2010

I have set up the XML as follows:

[Code]...

View 5 Replies

ActionScript 2.0 :: Using OnRelease Inside A For Loop

Aug 1, 2011

I am having a hard time trying to use an onRelease event handler inside a for loop. Basically, I am developping a custom player for articulate presenter using flash and AS2.This code is generating a movie clip in a for loop for each line in the sidebar, with slide title and slide number parsed from a XML.Until here, all works fine.But when I try to generate the onRelease event handler to play the wanted slide when I click on the line, the value inside the onRelease is always the highest value of i.Looks like the onRelease evaluates i only when I click on the line, after all the clips have been generated.[code]I have to find a way to capture the value of i for each clip.

View 2 Replies

ActionScript 2.0 :: MX: OnRelease Defined In For Loop - Always The Same?

Mar 7, 2005

I'm trying to have a bunch of buttons generated in a for loop, and I want the onRelease function defined so that each button has a unique e-mail address attached to it.As it stands now, all the buttons are being assigned the last e-mail address in the XML file. I've got more code in my actual file that creates text fields on top of the buttons, and they're displaying the correct info, so it's only the onRelease function that isn't working...Here's the abridged code:

var xmlPeopleList:XML = new XML();
xmlPeopleList.ignoreWhite = true;
xmlPeopleList.onLoad = function(bSuccess:Boolean) {
if (bSuccess) {

[code]....

View 1 Replies

ActionScript 2.0 :: MC Button Loop Won't OnRelease?

Sep 1, 2005

I have a loop to create clip buttons w/jpg images on face && load same jpgs into main viewer clip. Problem is, the mc buttons won't respond to onRelease.

for(i=1;i<3;++i)
{
var mc = "mc"+i; // button mc clip names

[code]......

View 14 Replies

ActionScript 2.0 :: [Flash 8] OnRelease In A FOR LOOP

May 8, 2007

I am making a few drag and drop games that work great when I hard code them. When I use a FOR loop and name = eval("something"+i+"_mc") everything works great. I can assign startDrag to all MCs, I can make it stop drag, and so on. But when I try to do a hitTest, it only works for the highest value of [i] in the FOR loop. It will still assign text to all the dynamic text boxes in each MC, and do the dragging stuff, but it won't do a hitTest for anything other than the highest value.

I've searched several sites and have found things about Delegate.create, using [this.i] rather than just [i], and much more. The problem is it always partially or half works. It won't just break, it will either let both drag and only acknowledge one hitTest, or ignore the stopDrag or whatever else. Either they both partially work, or only the highest [i] value is acknowledged.

View 1 Replies

ActionScript 2.0 :: MX OnRelease Defined In For Loop Always Same

Mar 7, 2005

So I'm trying to have a bunch of buttons generated in a for loop, and I want the onRelease function defined so that each button has a unique e-mail address attached to it.As it stands now, all the buttons are being assigned the last e-mail address in the XML file. I've got more code in my actual file that creates text fields on top of the buttons, and they're displaying the correct info, so it's only the onRelease function that isn't working.[code]

View 1 Replies

ActionScript 2.0 :: 3D Rotating Gallery - OnRelease And EnterFrame Loop

May 8, 2006

Here my attempt at creating the Kirupa's Spinning Images gallery. I'm so damn close it somewhat works, I'm still having trouble with the rotational calculations. Not sure, but I think I might be passing the wrong values from the onRelease to the enterFrame loop?

spin3a.fla
var world:Array = [];
var rotate = 0;
var fl = 1000;
var clip;
function spin() {
[Code] .....

View 1 Replies

ActionScript 2.0 :: Place A For Loop In A Recursive Function With The Function Call Within The Loop

Nov 4, 2005

If you place a for loop in a recursive function with the function call within the loop... will the loop finnish or does it stop working untill the last recursion?

View 2 Replies

ActionScript 2.0 :: OnRelease After Using LoadMovieClip Function

Sep 15, 2009

I need help with onRelease after using loadMovieClip function. onRelease doesn't work on duplicateMovieClip. The code:function buildGallery (page Position)[code]

View 2 Replies

ActionScript 2.0 :: Define Function Without OnRelease?

Mar 12, 2005

I need the following script to run as soon the as the play head comes on the frame. Right now it is activated through an onRelease...need to replace that:

myButton_btn.onRelease = function() {
tweenBall(mx.transitions.easing.Strong.easeOut);
};
function tweenBall(easeType) {

[Code].....

View 13 Replies

ActionScript 2.0 :: #include For OnRelease() Like This Or Function?

Apr 5, 2006

im trying to make this code below as modular as possible. I would like to edit in only one place if possible, as opposed to every button.

Code:
onClipEvent (mouseUp) {
this.onRelease = function() {
_parent._parent.bg_pic_linkage = "im6";

[Code].....

View 3 Replies

ActionScript 2.0 :: Add A 'onRelease' Function To Loaded Mc's?

Jul 21, 2006

take a look at my code. It only displays a square.

Code:
testClass = new Object();
testClass.childClass = new Object();

[code].....

View 8 Replies

ActionScript 2.0 :: OnRelease Cannot Trigger The Function?

Jan 23, 2008

a look/correct the attached file of why the onRelase function cannot triggered the loadImages function.

View 1 Replies

ActionScript 2.0 :: OnRelease Function With Parameter?

Mar 10, 2008

why this doesn't work:

Code:
listContainer.next.onRelease = advance(1);
listContainer.prev.onRelease = advance(-1);
function advance(d)

[code]....

I know I can reference a function onRelease without any parameters no problem, but what if I want to pass a parameter to the function?

View 5 Replies

ActionScript 2.0 :: Define This Function Without OnRelease?

Mar 12, 2005

I need the following script to run as soon the as the play head comes on the frame. Right now it is activated through an onRelease...need to replace that:

[Code]...

View 13 Replies

ActionScript 2.0 :: Flash8 OnRelease Function Not Working?

Mar 5, 2009

i have a movieclip on the main timeline, and inside that mc I have 1 button on first frame and 1 button of second frame...From the main timeline i run this script for frame 1 button...

publisering2.avpubliser_btn.onRelease = function(){
publisering2.gotoAndStop(2);
}

And this works fine.. however, i run the exact same script for the button on frame 2, ofcourse changing the path and gotoAndStop(1) instead... And this isnt working.. The button's over frame works so its activated...

View 3 Replies

ActionScript 2.0 :: Looping / Incrementing OnRelease Function?

Mar 6, 2009

Just getting up to speed on looping and incrementing variables. A real time saver.I have a onRelease function that I would like to apply to several button objects:

phase1a.but1.onRelease = function() {
p=0;
thisImage();
}

I need the p variable as well as the target but1 to increment. This is my first attempt:

for (n=1; n<=23; n++) {
phase1a.but[n].onRelease = function() {
p=[n+1];[code].......

I get a good trace on n showing that the incrementing is successful but nothing on p when the button is clicked and no execution of the function thisImage(). Not getting any errors either. Can you not loop an onRelease statement?

View 13 Replies

ActionScript 2.0 :: CS4: Loaded SWF OnRelease Function Not Working?

Aug 19, 2009

I am working in CS4, but using as2 as the publish setting since the swf I need to load in was previously done in as2.I have an interface that I am loading a logo.swf into. This logo has animation that works properly both in test and in the browser. There is, however, a function in the logo.swf that is not working.

this.onRelease = function() {
getURL("http://www.yourdomainhere.com");
}

When I test with the IDE this is clickable within the interface, but when I view via the webpage it is not. AllowScriptAccess was set to sameDomain, but I have also tried that set to always.

View 3 Replies

ActionScript 1/2 :: Pass Parameter To OnRelease Function

Sep 26, 2011

Is there any way to pass parameters to mc.onRelease?

View 5 Replies

ActionScript 2.0 :: GetURL Not Working Even With OnRelease Function

Jan 3, 2008

I can't get my getURL to work. It works when I use "_blank" but not when I use "_self" or "_parent" or "_top" or leave it empty. I've got it right off the main timeline. I've also tried putting it within an onRelease function.

So, this doesn't work:
Code:
getURL("images/aboutus.jpg", "_self");
But this does:
Code:
getURL("images/aboutus.jpg", "_blank");

View 9 Replies

ActionScript 2.0 :: Can't Access The Variable I In The OnRelease Function?

Sep 23, 2006

Strangely enough I can't access the variable i in the onRelease function below. I guess it must have something to do with the position where I declared it. But I also tried to declare it outside of the functions but it didn't work either.. how to solve this problem?

[Code]...

View 3 Replies

ActionScript 2.0 :: [Flash8] OnRelease Function() With Unique Ids

Sep 27, 2006

I have the following code that lists 5 buttons with dynamic texts... when pressing each button a popUp_mc window will appear with some content show in dynamic text. Only one of these 5 buttons have some images that will have symbols_mc appear... in this case I just alpha this symbol to 100 only for this button, but for the rest alpha = 0. The button the I want to show the symbol is the third one. I'm a bit confused on how to show this symbol according to the following code below.

[Code]....

View 7 Replies

ActionScript 2.0 :: Movieclip.onRelease = Function() Without OnReleasing?

Aug 29, 2007

mc.onRelease = function(){
//Do something
}

I have this function on "mc".And I would like to call the function on ''mc" without clicking on "mc". How can I create the state where this "mc" is being pressed by script on a frame or another button?

View 2 Replies

ActionScript 2.0 :: Change The Function From OnPress To OnRelease?

Aug 22, 2009

I have some script for a sliding gallery and buttons to move the images. how to change the function from onPress to onRelease so I can animate the button.

this.onEnterFrame = function(){
if(rewind == true && counter > 0){
counter = counter - 1;

[Code]....

View 3 Replies

Checkbox Within A Movieclip That Has A OnRelease Function, Doesn't Check

Jun 29, 2009

I have a movie clip which has onRelease, onRollOver and on onRollOut functions associated with it. Within that movieclip I also have a checkbox, but the checkbox does not check when I click on it. When i disable the "on" functions, the checkbox is then working as normal.
 
Is there a way I could have the "on" functions and the checkbox working simultaniously?

View 1 Replies







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