Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




MovieClip.onRelease Function Question



I guess I need to turn to the experts on this one. It's probably very simple, however I am missing the solution.Here is the code I am using:
Code:
btContact.onRollOver = over;btContact.onRollOut = out;btContact.onRelease = followLink("contact.swf");//Start codefunction over() { trace("Rollover");}function out() { trace("Rollout");}function followLink(linky:String):Void { trace(linky + " Clicked.");}// NOTE btContact is a movieclip// End code
The onRollOver and onRollOut triggers to their respective function calls work great. However, as I watch the output panel, followLink is run as soon as I hit Test Movie in Flash and not when I click on the movieclip. So if I have other buttons referring to that function, it runs that many times. Am I missing something? I sometimes don't explain things very well, so let me know if you need more information.Thanks so much, new friends.dsJonCole



KirupaForum > Flash > Flash 8 (and earlier)
Posted on: 06-02-2006, 11:13 AM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

MovieClip.onRelease = MovieCLip.Protoype Function Fails To Execute Properly
Dear all,

I created a simpe function:

MovieClip.prototype.hiMe = function(me, theRest)
{
//declare the format colors white and grey
formatMe = new TextFormat();
formatMe.color = Colors[0];
formatMe.font = "Adventure Subtitles";

formatTheRest = new TextFormat();
formatTheRest.color = Colors[1];
formatTheRest.font = "Adventure Subtitles";

// assign grey to theRest
for (i =0 ; i < theRest.length; i++)
{
theRest[i].tfield.setTextFormat(formatTheRest);
}
// make the me white
me.tfield.setTextFormat(formatMe);

}

when I call it (bar[0] is an array of objects)
bar[0].invar.onRelease = hiMe(bar[0],bar);

it executes on load regardless of the onRelease eventHandler and the ownards it does not execute when exciting the event.

does somebody know why this may be?

Cheers

DDT

MovieClip.onRelease = MovieCLip.Protoype Function Fails To Execute Properly
Dear all,

I created a simpe function:

MovieClip.prototype.hiMe = function(me, theRest)
{
//declare the format colors white and grey
formatMe = new TextFormat();
formatMe.color = Colors[0];
formatMe.font = "Adventure Subtitles";

formatTheRest = new TextFormat();
formatTheRest.color = Colors[1];
formatTheRest.font = "Adventure Subtitles";

// assign grey to theRest
for (i =0 ; i < theRest.length; i++)
{
theRest[i].tfield.setTextFormat(formatTheRest);
}
// make the me white
me.tfield.setTextFormat(formatMe);

}

when I call it (bar[0] is an array of objects)
bar[0].invar.onRelease = hiMe(bar[0],bar);

it executes on load regardless of the onRelease eventHandler and the ownards it does not execute when exciting the event.

does somebody know why this may be?

Cheers

DDT

Removing The OnRelease Function Of A MovieClip
I have a movie clip on stage and am giving it the functionality of a button via actionscript:

col1_mc.onRelease = function() {
_parent.loadPlan(this, this._parent)
};

The function loadPlan() tells the calling movieClip to play. On frame 10 of the calling movie clip are further movie clips with their own functionality, but when I go to click on one of these the parent clip's function is triggered.

How can i overcome this problem?

Thanks

Movieclip.onRelease = Function() Without OnReleasing.
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?

MovieClip OnRelease Function Not Working
I've read some other posts on this, but they went off subject, so I'll try it myself. The problem is the following, I have written an onRelease function for a movieClip. The first time the you click the button it works, but when you don't move the mouse and click again, nothing happens...

It's a very simple script:


ActionScript Code:
prevBtn.onRelease = function(){
        trace("prev clicked");
        prevImage();
    }



Anyone knows why I first have to move my mouse again before the onRelease event is executed again?

Hide OnRelease Function When MovieClip Covered?
Dang, I thought Flash took care of this.

When you have MovieClip with an onRelease function, and it's covered by another object, how do you go about hiding the onRelease function?

What's best practice in this situation?

Thanks sesaki, you're right I should've done a better search. I'll delete my post if you delete yours? :wink:

Problem With OnRelease For MovieClip Inside Draggable MovieClip [Flash Pro 8]
I have a movie clip, circle_mc, and in it is embed another movie clip, point_mc. I made the circle draggable with this:


Code:
circle_mc.onPress = function() {
startDrag(this);
};
circle_mc.onRelease = function() {
stopDrag();
};
and that part works fine.

I also want to be able to click on point_mc which is within the circle_mc movie clip. So, I added this:


Code:
circle_mc.point_mc.onRelease = function() {
trace("click was successful");
}
This does not work, and I'm pretty sure it is BECAUSE its parent clip is draggable and therefore has its own onRelease function. (If I comment-out the drag code, then the other code works as intended.)

Is there any way to do this or am I out of luck?

[F8] OnRelease = Function()
hi can someone point me in the right direction

//create multilevel array
select_lv.onLoad = function(Boolean) {
num = parseInt(this.n);
// create vars from array
for (var i:Number=0; i < num; i++) {
Info.push({id:this["id"+i],itemname:this["itemname"+i],quantity:this["quantity"+i],totalcost:this["totalcost"+i] });

//display part of the array
itemname.text = Info[1].itemname;
//display quantity and cost from array
//price.text = Info[1].quantity+ " | " +Info[1].totalcost;
price.text = Info[1].totalcost;


object_image.onRelease = function() {
total.text = Info[1].totalcost;
}

// load image from category txt value into Mc object_image
sel_item = _root.itemname.getValue()
loadMovie(imgpath + sel_item + ".jpg","object_image")


//trace variable to output window
//trace (select_lv);
}
}

// load all from db
select_lv.sendAndLoad(filepath + "Selectwine.php", select_lv, "GET");

the red area is where the problem is, for some reason when the jpg is loaded into the movieclip object_image i cannot seem to use it as a button, which is what i want to achieve, the cursor does not even react to a rollover...

i can add code to the movieclip and it works however i would like to keep all the code in one place, all content is on the main timeline and i can trace the var into another text field.....grrr

thanks in advance

OnRelease Function
I have set up a number of loader objects and set up locations of the images I want to load and link urls I want assigned to each image using loops like this:

for (var j = 1; j<url_XML.firstChild.childNodes.length/2+1; j++) {
images[j]=this.createClassObject(mx.controls.Loader, "myLoader"+j, j);
images[j].scaleContent = false;
}

for (var i=0; i<url_XML.firstChild.childNodes.length; i++) {
if (i < url_XML.firstChild.childNodes.length/2) {
urls = url_XML.firstChild.childNodes.childNodes;
}
else {
links[i-(url_XML.firstChild.childNodes.length/2)] = url_XML.firstChild.childNodes.childNodes;
}
}

This worked great, and then I used a loop to assign each image to the page like this:

for (var i=0; i<urls.length; i++) {
images[i+1].contentPath = urls;
images[i+1]._x = i*320;
images[i+1]._y = 0;
}

This also worked great, but when I used the following loop to set up a link url for each image, the link does not work:

for (k=0; k<links.length; k++) {
images[k+1].onRelease = function() {
getUrl(links[k]);}
}
}

When I just used this it worked fine for the one function:
var k = 0;
images[k+1].onRelease = function() {
getUrl(links[k]);}

But I can not get the loop to work so I actually create all functions. Any ideas what I'm doing wrong and what I can do to make it work? Thanks for any help!

Bob


I have since figured this out. This is what I used, and it works fine:

for (var i=0; i<links.length; i++) {
images[i+1].iVar = i;
images[i+1].onRelease = function() {
getUrl(links[this.iVar]);}
}

Thanks!





























Edited: 07/31/2008 at 11:04:07 AM by BobMelnyk

OnRelease = Function
i know that there is another way to write this code, a short way... can some one help me out?


ActionScript Code:
subMenu01_btn.onRollOver = function() {    over(subMenu01_btn);};


thx
.am

[f8] OnRelease = Function Help
Hi All,

I can't seem to figure out how to get this to work when I place the button into an MC.. Would it be ._parent.? this didn't work either..

It's 3 MC's off the _root. the buttons work great when they are on the main root.



Code:
this.onRelease = function(){
if (_root.currMovie == undefined) {
_root.currMovie = "about";
container.loadMovie("about.swf");
} else if (_root.currMovie != "about.swf") {
if (container._currentframe>= container.midframe) {
_root.currMovie = "about";
container.play();
}
}
}

This.onRelease = Function()
Okay, I've got an MC on my stage that has the following script on the first frame of it's timeline:


ActionScript Code:
stop();
if (_root.zoomTool == 1) {
    this.onRelease = function() {
        _root.gotoAndPlay("zoom");
    };
}


This runs great. What I want to do is after this plays, I want this to be disabled. I've tried writing the following script but it doesn't seem to work:


ActionScript Code:
stop();
if (_root.zoomTool == 1) {
    this.onRelease = function() {
        _root.gotoAndPlay("zoom");
    };
}
_root.zoomTool = 2;


I would have thought that this would stop the if from being active since now "zoomTool" isn't equal to 1. But no, it still runs. I even tried putting in an "else" into this if statement but I couldn't get it to work...flash kept telling me that I had errors in my script even though I couldn't find any. I'll post that just to see if anyone can tell me what's wrong with it:


ActionScript Code:
stop();
if (_root.zoomTool == 1) {
    this.onRelease = function() {
        _root.gotoAndPlay("zoom");
    } else {
trace (_root.zoomTool);
};
}


Then in a frame in _root after it plays the "zoom" label, I put the "_root.zoomTool = 2;" script. I put the trace in my if statement hoping that my output window would put a 2 in it...which to me looked like it would happen. But no, the if statement kept playing as if zoomTool was still equal to 1.

I'm thinking that when I use the script "this.onRelease = function()..." that it is then assigned throughout the clip. Is this so? If so, how can I disable it after it's played through once?

Thanks for the help in advance!

OnRelease = Function() - Levels
I can't this to work:

_level20.button1_mc.onRelease = function() {
play();
};


I don't get the the hand cursor. "interface.swf" is definately in level 20 and loads (I see the graphics). MC, instance name, "button1_mc" is on level 20's root. Yet, I rollover it...nothin'. But this works in a swf without using levels.

??
Thanks,
rez

Call An OnRelease Function
is there any way to call this same function from a button on a different level in as2? i want 2 different buttons to do the same thing, only they are on different levels, is this possible? if so how?
tyia =D


gbtn.onRelease = function() {
whichFrame = "garrett";
gbtn._x = 430;
profiles.gotoAndPlay("play");
garrettBox.onEnterFrame = function() {
this._x = 430-(430-Math.ceil(this._x))/1.1;
};
};

Passing Var To OnRelease Function
Isn't it supposed to work !!!!

Code:
i = 1;
some_mc.onPress = function(i){
trace(i);
}

seams like i is not passing to the function at all !!!

can anyone explain please ? plus maby some hints how to make it work

[F8] OnRelease = Function () Question Please Help
Hi,

I am using attachMovie to place some movie clips on the stage. I want to create an onRelease function for them.


If I specify the exact path of the movie clip, then it works. E.g.

box_g10.button_g.onRelease = function () {
trace ("onRelease called")
}


But if I define variables such as:

var boxname_g = 'box_g'+a
var mybutton_g = boxname_g+'.button_g'

so one instance of mybutton_g now equals 'box_g10.button_g'


and then use:

mybutton_g.onRelease = function () {
trace ("onRelease called")
}



It doesn't work. Perhaps it's looking for a movie clip called mybutton_g insead of the contents on the variable...

Any help would be greatly appreciated!

Thanks,
Rik

OnRelease Function For Buttons
Why is it that my onRelease function is working for movie clips, but not for buttons?

[F8] Onrelease Function Problems
i Have a slider to control volume and it works almost perfectly except that if i mouse out of the slider MC and then release my mouse button flash doesn't seem to recognize this and i can still affect the slider by moving my mouse around even though i am no longer holding the mouse button.

the code that i have is on the first frame of my swf and is basically

Code:
tool.button.slider.volslide.onRelease = stopslider;
//stopslider function
function stopslider() {
tool.button.slider.volslide.stopDrag();
}


This code works as long as i don't mouse out of volslide before i release my mouse button but if i do then i get problems. Any solutions would be greatly appreciated.

Thank you

OnRelease = Function Problem
In this code..

_root.enemy.onRelease=function(){
// My AI script goes in here
}

how can i make it so the AI script keep going even after i click the enemy cause the AI only runs right when i click it then stops.

Programmatically Run An OnRelease Function
Hi all.
I have the following code

PHP Code:




_root["pin"+i].onRelease = function() {
   trace(i)
}






Which is in a loop where i is incremental.

What I want is at the end of the loop to randomly choose a number and then run the on release function somthing like

_root["pin"+rndNumber].onRelease = true

Is there a way. The real function can not be made into a standalone function so needs to be in the loop

[F8] OnRelease Like Function Within Loops?
Hello!
I need to run an mc.onRelease function for several mcs and it isn't always the same number of mcs, so I'm trying to get how to get it done. Obviously, the following code won't work just thrown on the main frame.

Code:
for (n=1; n<maxmc; n++) {
_root["mc"+n].onRelease = function() {
trace(_root["mc"+n]+" released");
};
}

but the thing is it won't work right on an onEnterFrame function neither.
I'm kind of lost, can anyone help me?

Thanks!

OnRelease Function Is Not Working
var moviename = "movie_mc" + j;
var movielevel = 1+j;

_root.createEmptyMovieClip(movie_mc, movielevel);
loadMovie("images/" + thumbnail + ".jpg", movie_mc);


_root[movie_mc].onRelease = function(){
trace("sd");
};


The image is loading in the movie and working properlly.But in case of onRelease function it is not working . Pls help the red line is not working.

OnRelease = Function () Question
Hi,

I am using attachMovie to place some movie clips on the stage. I want to create an onRelease function for them.


If I specify the exact path of the movie clip, then it works. E.g.

box_g10.button_g.onRelease = function () {
trace ("onRelease called")
}


But if I define variables such as:

var boxname_g = 'box_g'+a
var mybutton_g = boxname_g+'.button_g'

so one instance of mybutton_g now equals 'box_g10.button_g'


and then use:

mybutton_g.onRelease = function () {
trace ("onRelease called")
}



It doesn't work. Perhaps it's looking for a movie clip called mybutton_g insead of the contents on the variable...

Any help would be greatly appreciated!

Thanks,
Rik

OnRelease Function Not Working
Hi everyone,

I have a movieclip on the main timeline called "WebMonitor_mc". Inside this clip is a button called "close_btn". On the first frame of the main timeline I have the following code:

WebMonitor_mc.close_btn.onRelease = function () {
webMonitor_mc._visible = false;
}

I'm trying to get "close_btn" to make "webMonitor_mc" to become invisible, but the code doesn't seem to work. The hand cursor appears when you roll over "close_btn" but when you press and release the other clip doesn't become invisible.

Am I targetting things incorrectly? Could someone tell me what I might be doing wrong?

Thanks for any help offered.

My OnRelease Function Not Working
I am trying to get the text value of my movieclip using the onRelease method. If I trace("btn_works") I get "btn_works" in the edit window, but I am unable to retrieve the text value of the button. What am I doing wrong?

Code:
for (i=0; i<5; i++) {
_root.attachMovie("VideoText", "video_mc"+i, 60+i);
_root["video_mc"+i].v_text.html = true;
_root["video_mc"+i].v_text.htmlText = "<font face='Arial' size='12' color='#000000'><u>"+this["video"+i]+"<b></font>";
//trace(_root["video_mc"+i].v_text.text);
_root["video_mc"+i]._x = 600;
_root["video_mc"+i]._y = 250+(i*20);
_root["video_mc"+i].onRelease = function() {
//trace("btn_works")
trace(_root["video_mc"+i].v_text.text);
};
}

Problems With OnRelease Function
I am relatively new to actionscripting, I don't know what I've done wrong, and I'm not getting errors. HELP!

I have been working on this problem for 3 days now, with no luck. I really need help. I am trying to set up my website. I have the company logos at the top of the page, both are acting as buttons to the home page. Then I have, 6 other buttons: about_us, our_work, our_offices, in_development, PRESS, and contact_us. This is the way I've labeled the slides inside my flash presentation, and how I labeled the mc to correspond to the slides for easier scripting. Since I'm new, I am wondering two things, first am I scripting this the long way? Two I am having issues with connecting my buttons onRelease to slides, and a minor glitch with my pointer between the mc buttons and the Logo buttons.

Here is the code










Attach Code

on (load) {
import mx.transitions.*;
import mx.transitions.easing.*;
lastTarget = "home"


this.btnLogo.onRollOver = function() {
mcLogo.gotoAndPlay("_over");
};
this.btnLogo.onRollOut = function() {
mcLogo.gotoAndPlay("_out");
};
this.btnLumtype.onRollOver = function() {
mcLuminairtype.gotoAndPlay("_over");
};
this.btnLumtype.onRollOut = function() {
mcLuminairtype.gotoAndPlay("_out");
};
this.about_us.onRollOver = function() {
about_us.gotoAndStop("_over");
};
this.about_us.onRollOut = function() {
about_us.gotoAndStop("_out");
};
this.our_work.onRollOver = function() {
our_work.gotoAndStop("_over");
};
this.our_work.onRollOut = function() {
our_work.gotoAndStop("_out");
};
this.our_offices.onRollOver = function() {
our_offices.gotoAndStop("_over");
};
this.our_offices.onRollOut = function() {
our_offices.gotoAndStop("_out");
};
//In Development Rollover animation
this.in_development.onRollOver = function() {
in_development.gotoAndStop("_over");
};
//In Development Rollout animation
this.in_development.onRollOut = function() {
in_development.gotoAndStop("_out");
};
//Press Rollover animation
this.PRESS.onRollOver = function() {
PRESS.gotoAndStop("_over");
};
//Press Rollout animation
this.PRESS.onRollOut = function() {
PRESS.gotoAndStop("_out");
};
//Press Rollover animation
this.contact_us.onRollOver = function() {
contact_us.gotoAndStop("_over");
};
//Press Rollout animation
this.contact_us.onRollOut = function() {
contact_us.gotoAndStop("_out");
};

btnLogo.onRelease = btnLumtype.onRelease = function() {
this._parent._parent.pages.gotoSlide(this._parent. _parent.pages[this._name]);
var pointertween:Tween = new Tween(this._parent.mcPointer, "_x", Strong.easeOut, this._parent[lastTarget]._x, this._parent["home"]._x, 1, true);
lastTarget = this.name;
};

home.onRelease = about_us.onRelease = our_work.onRelease = our_offices.onRelease = in_development.onRelease = PRESS.onRelease = contact_us.onRelease = function() {
this._parent._parent.pages.gotoSlide(this._parent. _parent.pages[this._name]);
var pointertween:Tween = new Tween(this._parent.mcPointer, "_x", Strong.easeOut, this._parent[lastTarget]._x, this._x, 1, true);
lastTarget = this._name;
};
}

How To Define This Function Without OnRelease?
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) {
var begin = -50;
var end = 100;
var time = 20;
var mc = ball_mc;
ballTween = new mx.transitions.Tween(mc, "_y", easeType, begin, end, time);
}

#include For OnRelease() Like This Or Function?
hello

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.

any ideas would be greatly appreciated


ActionScript Code:
onClipEvent (mouseUp) {    this.onRelease = function() {        _parent._parent.bg_pic_linkage = "im6";        url_target = "swfs/contact.swf";        _parent.whichSection = "contact";        /*                   can this bit below be #include 'd                    */        if (_parent._parent.currMovie != _parent._parent.bg_pic_linkage) {            if (_parent._parent.bg._currentframe == _parent._parent.bg.midframe) {                _parent._parent.currMovie = _parent._parent.bg_pic_linkage;                _parent._parent.bg.play();                loadMovie(url_target, _parent._parent.content_mc);                _parent.play();            }        }    };}

How Do I Add A 'onRelease' Function To Loaded Mc's
Hi! Could anyone take a look at my code. It only displays a square.

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

function doTest() {
_root.attachMovie("empty_mc", "container", 0);

testClass.test = _root.container;

// Hmm.. Am I right on this? If I were to write code in Java equivalent to this, would that code be like:
// obj_name = new testClass.childClass()
testClass["obj_name"] = new testClass["childClass"]();
// But the thing is that, the testClass object holds the newly created "obj_name" in it. Am I right?

// Just attaches it to _root. Voila! It shows on the stage.
testClass.test.attachMovie("square_mc", testClass["obj_name"], 1);
}

doTest();
How can I add an 'onRelease' function to the childClass?
I tried this:

Code:
testClass.childClass.onRelease = function() {
trace("onRelease called");
}
Doesn't work...

Help please?

OnRelease Stop Function? Help
Hey guys, i have a pressing issue here was wondering if anyone could help me with.

I have a small movie that basically is a mask that when you click on it it follows the mouse to reveal the other image under it. I dont want a circle bit of a mask, i want the mask to be 1/2 the stage size and only scroll on the x plane. I have this setup and working more less except for the fact i cant "uncall" (yes i just made that up) the function. heres my code


ActionScript Code:
var speed = 5;MovieClip.prototype.follow = function() { this.onEnterFrame = function() {  this._x += (_root._xmouse-this._x)/speed;  if (Math.abs(_root._xmouse-this._x)<1 && Math.abs(_root._ymouse-this._y)<1) {   delete this.onEnterFrame;  } };};//drag the maskmask.onPress = function() { mask.follow();};


as you can see the mask when pressed gets the follow function attatched, but i cant get it to stop moving when you release. I have tried all manners of onRelease to no avail...what can i do?

I would use the startDrag function but i love the easing (and i dont know how to constrain start/stopDrag to the X axis)

Any help would be great!

Thanks

--][--

OnRelease Call Function
Hello,

i using createTextField e createEmptyMovieClip to create itens to my menu. this is a function.

how can i do this itens disappears and call another function onRelease one of this itens?

thanks

OnRelease > Swap Function?
Hello,
I have a rollOver / rollOut state on a MC. Is there an easy way to stop its rollOut state after it has been 'released'?
Code:
myMC.onRollOver = function(){ plonk;}
myMc.onRollOut = function(){ plink;)
myMc.onRelease = function(){
myMc.disable.onRollOut(); //???
}
Any ideas?
Thanks!!

OnRelease Cannot Trigger The Function
Can someone have a look/correct the attached file of why the onRelase function cannot triggered the loadImages function. Appreciate for your help.

Please download the file here

OnRelease Function With Parameter?
I don't quite understand why this doesn't work:


ActionScript Code:
listContainer.next.onRelease = advance(1);listContainer.prev.onRelease = advance(-1);function advance(d){    // function stuff in here    trace("advance function called");}


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?

How To Define This Function Without OnRelease?
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) {
var begin = -50;
var end = 100;
var time = 20;
var mc = ball_mc;
ballTween = new mx.transitions.Tween(mc, "_y", easeType, begin, end, time);
}

OnRelease Function Not Working
Hi everyone,

I have the following code on frame 1 of the main timeline:

this.categoryIndex_mc.indexBack_mc.backToIndex_btn.onRelease = function ():Void {
     trace("button pressed");
      oIntervalIDs[garmentSlides_mc._name] = setInterval(fadeMovieClip, 0, garmentSlides_mc, 5);
      new Tween(categoryIndex_mc, "_y", null, 412, 107, 3, false);
      categoryIndex_mc.indexBack_mc.gotoAndStop("chooseText");
}

When I test the movie I get the hand cursor appear when I rollover the button indicating that it is in fact a button but when I press and release it, none of the code works. I added the trace statement to see what was going on but again when testing it the output window doesn't appear.

Can someone tell me if there's something wrong with the code? The following is the entire code on frame 1 of the main timeline.

Appreciate any help offered.



CODE

//-----------Initialization---------\
import mx.transitions.Tween;
this.categoryIndex_mc._alpha = 0;
this.garmentSlides_mc._alpha = 0;
//-----------------------------------\

//-----------Introductory animation plays---------\

intro_mc.onEnterFrame = function () {
this.play();
delete intro_mc.onEnterFrame;
}
//-----------------------------------\


//-----------Category list fades in---------\

var oIntervalIDs:Object = new Object();

function fadeMovieClip (mClip:MovieClip, nRate:Number):Void {
        if(mClip._alpha >= 0 && mClip._alpha < 100) {
             var nAlpha:Number = mClip._alpha;
            mClip._alpha = nAlpha + nRate;
            updateAfterEvent();
        }
    else {
        clearInterval(oIntervalIDs[mClip._name]);
        }
    }

oIntervalIDs[categoryIndex_mc._name] = setInterval(fadeMovieClip, 100, categoryIndex_mc, 5);

categoryIndex_mc.onEnterFrame = function () {
if(categoryIndex_mc._alpha > 95) {
    this.indexBack_mc.gotoAndPlay("chooseText");
    delete categoryIndex_mc.onEnterFrame;
}
}

//-----------------------------------\


//-----------Slideshow fades in, category index slides out, playhead jumps "back to index" frame ---------\

cat_btn.onRelease = function ():Void {
    oIntervalIDs[garmentSlides_mc._name] = setInterval(fadeMovieClip, 100, garmentSlides_mc, 5);
    new Tween(categoryIndex_mc, "_y", null, 107, 412, 3, false);
    categoryIndex_mc.indexBack_mc.gotoAndStop("backToIndex");
}
//-----------------------------------\


//-----------Slideshow fades out, category index slides in, playhead jumps "please choose category" frame---------\

this.categoryIndex_mc.indexBack_mc.backToIndex_btn.onRelease = function ():Void {
     trace("button pressed");
      oIntervalIDs[garmentSlides_mc._name] = setInterval(fadeMovieClip, 0, garmentSlides_mc, 5);
      new Tween(categoryIndex_mc, "_y", null, 412, 107, 3, false);
      categoryIndex_mc.indexBack_mc.gotoAndStop("chooseText");
}

//-----------------------------------\

OnRelease Function Not Working
Hi everyone,

I have the following code on frame 1 of the main timeline:

this.categoryIndex_mc.indexBack_mc.backToIndex_btn.onRelease = function ():Void {
     trace("button pressed");
      oIntervalIDs[garmentSlides_mc._name] = setInterval(fadeMovieClip, 0, garmentSlides_mc, 5);
      new Tween(categoryIndex_mc, "_y", null, 412, 107, 3, false);
      categoryIndex_mc.indexBack_mc.gotoAndStop("chooseText");
}

When I test the movie I get the hand cursor appear when I rollover the button indicating that it is in fact a button but when I press and release it, none of the code works. I added the trace statement to see what was going on but again when testing it the output window doesn't appear.

Can someone tell me if there's something wrong with the code? The following is the entire code on frame 1 of the main timeline.

Appreciate any help offered.



CODE

//-----------Initialization---------\
import mx.transitions.Tween;
this.categoryIndex_mc._alpha = 0;
this.garmentSlides_mc._alpha = 0;
//-----------------------------------\

//-----------Introductory animation plays---------\

intro_mc.onEnterFrame = function () {
this.play();
delete intro_mc.onEnterFrame;
}
//-----------------------------------\


//-----------Category list fades in---------\

var oIntervalIDs:Object = new Object();

function fadeMovieClip (mClip:MovieClip, nRate:Number):Void {
        if(mClip._alpha >= 0 && mClip._alpha < 100) {
             var nAlpha:Number = mClip._alpha;
            mClip._alpha = nAlpha + nRate;
            updateAfterEvent();
        }
    else {
        clearInterval(oIntervalIDs[mClip._name]);
        }
    }

oIntervalIDs[categoryIndex_mc._name] = setInterval(fadeMovieClip, 100, categoryIndex_mc, 5);

categoryIndex_mc.onEnterFrame = function () {
if(categoryIndex_mc._alpha > 95) {
    this.indexBack_mc.gotoAndPlay("chooseText");
    delete categoryIndex_mc.onEnterFrame;
}
}

//-----------------------------------\


//-----------Slideshow fades in, category index slides out, playhead jumps "back to index" frame ---------\

cat_btn.onRelease = function ():Void {
    oIntervalIDs[garmentSlides_mc._name] = setInterval(fadeMovieClip, 100, garmentSlides_mc, 5);
    new Tween(categoryIndex_mc, "_y", null, 107, 412, 3, false);
    categoryIndex_mc.indexBack_mc.gotoAndStop("backToIndex");
}
//-----------------------------------\


//-----------Slideshow fades out, category index slides in, playhead jumps "please choose category" frame---------\

this.categoryIndex_mc.indexBack_mc.backToIndex_btn.onRelease = function ():Void {
     trace("button pressed");
      oIntervalIDs[garmentSlides_mc._name] = setInterval(fadeMovieClip, 0, garmentSlides_mc, 5);
      new Tween(categoryIndex_mc, "_y", null, 412, 107, 3, false);
      categoryIndex_mc.indexBack_mc.gotoAndStop("chooseText");
}

//-----------------------------------\


Combobox Onrelease (?) Function
Please help,

have created a form in flash MX that contains a number of comboboxes. I populate these boxes by loading values from mySQL via PHP. So far so good...

my problem is in finding the correct event to run some code after a selection has been made.

currently i am using the onrelease function to populate a dynamic text field with the index of the selected item. (until i can figure out exactly what i'm going to do with the selected values!!)

     selTeam_mc.cboPl_gk.onRelease = function() {
       var plval;
       plval = selTeam_mc.cboPl_gk.getselectedindex();
       selTeam_mc.temp_txt.text = plval;
     };

The only problem is, i click on the combobox to open the list, (the field updates with the last selected item), when you then select a new item, this doesn't update the field. (At the moment the value in the temporary text field lags behind the value selected in the combobox)

So i guess the question i am asking is; what event can i use for my combobox that will update my field as soon as an item is selected?

I hope you can understand my ramblings,

C



OnRelease Function Not Working
I seem to be having a bit of a blonde moment here ...

I have a MC on my stage and in there is another MC with a tween. at the end of the tween I have


ActionScript Code:
stop();
right_btn.onRollOver = function(){
    this.gotoAndPlay("b_over");
}


It doesn't read what so ever ... i even threw a trace in there and nothing ...

Sandman9

[AS 2.0] Undefined From Onrelease Function
A bit embarrased guys but its been a while since i action scripted since i am project managing mostly now. ANy how could you guys look at my code and tell me why I am getting "undefined" in my out put when i run the onrelease function.

ActionScript Code:
navHolder_mc.histiory_btn.onRelease = function () {
//--------------------Get Undefined here--------
                trace(aboutArray[i].firstChild.nodeValue);
            };

I know it must be something dumb i am not doing right. All the code on the bottom. When I trace it in the for loop i get the correct text which should trace "history" but inside the function it is not calling it.

Thanks!



ActionScript Code:
var ifpc:XML = new XML();
ifpc.ignoreWhite = true;
ifpc.onLoad = function(success:Boolean) {
    if (success) {
        // Retrieve all names in the path xml/*/about.
        var headerTitleArray:Array = XPathAPI.selectNodeList(this.firstChild, "/xml/page/about/headerTitle");
        var aboutArray:Array = XPathAPI.selectNodeList(this.firstChild, "/xml/page/about/text");
        var historyTitArray:Array = XPathAPI.selectNodeList(this.firstChild, "/xml/page/history/headerTitle");
        // Retrieve Evetnt Calendar in the path xml/*/title date calendar
        var eventArray:Array = XPathAPI.selectNodeList(this.firstChild, "/xml/page/events/item/title");
        //
        for (var i:Number = 0; i<aboutArray.length; i++) {
            //about
            trace(headerTitleArray[i].firstChild.nodeValue);
            trace(aboutArray[i].firstChild.nodeValue);
            //history
            trace(historyTitArray[i].firstChild.nodeValue);
            trace(eventArray[i].firstChild.nodeValue);
            //title of page
            headerGRN_mc.headerTitle_mc.headerTitle.autoSize = "left";
            headerGRN_mc.headerTitle_mc.headerTitile.text = headerTitleArray[i].firstChild.nodeValue;
            //loads text
            aboutText_mc.aboutText.autoSize = "left";
            aboutText_mc.aboutText.htmlText = aboutArray[i].firstChild.nodeValue;
            //
            navHolder_mc.histiory_btn.onRelease = function () {
//--------------------Get Undefined here--------
                trace(aboutArray[i].firstChild.nodeValue);
            };
        }
    } else {
        trace("XML loading failed !!!");
    }
};
ifpc.load("xml/ifpc.xml");

Onrelease Function Not Working?
Hi guys.. I here have my .fla file:
http://www.blaabjerglyngbo.1go.dk/Krching.fla

The Enter movieclip is not active.. how come?

thanks guys..[/url]

ListComp. OnRelease Function
I have this code from a friend of mine... but I don't really know how to make onRelease function so when I click on the movieClip "imgPlace" to get an url from the xml file

I have tried some things but I had bad results

Here is the code:
Code:

stop();
var listBox:mx.controls.List;

listBox.iconFunction = function(item) {   
   if(item.icon.indexOf("photoshop")!=-1) return "photoshopIcon_mc";
   if(item.icon.indexOf("illustrator")!=-1) return "illustratorIcon_mc";
   if(item.icon.indexOf("flash")!=-1) return "flashIcon_mc";
}

var listListener:Object = new Object();
listListener.change = function(eventObject:Object) {   
    
     var urlToGO:String = eventObject.target.value;
     unloadMovie(imgPlace);
     loadMovie(urlToGO,imgPlace);

   
};
listBox.addEventListener("change", listListener);

listBox.iconField = "icon";
var lBox:XML = new XML();
lBox.ignoreWhite = true;

lBox.onLoad = function() {
   var input:Array = this.firstChild.childNodes;
   for (i=0;i<input.length;i++) {
   listBox.addItem({ data:input[i].attributes.link,
                     label:input[i].attributes.beschrijving,
                      icon:input[i].attributes.icoon
               });
   }
}
lBox.load("data.xml");

Movieclip OnRelease
Hi everyone

my problim is:

I change my cursor with othe movielip and i want, when i rollOver to movieclip wich one has function release, my cursors's movieclip make something.
How to catch wich movieclip has onRelease function?

Thanks

MovieClip.onRelease ?
i used createEmptyMovieClip in a loop to show images from external file. My problem right now is how do i make each new movieclip clickable so that i can call external file into flash?

this is something i did to test its functionality..please correct me if i'm wrong :


Code:
onClipEvent (load) {

for (i=0; i<3; i++){
createEmptyMovieClip("holder"+i, i);
loadMovie(i+1+".jpg","holder"+i);
setProperty("holder"+i, _y, -"0");
setProperty("holder"+i, _x, "40"*i);
}
_root.holder[i].onPress = function (){
loadMovie("1.jpg","_root.screen");
}
}
anyone?help me please...

Movieclip OnRelease
Hi,
It's been a long time since I did some flash and now I'm stuck on something that should be easy...

I have a movieclip and I load a png file into it.
then I want to put an onRelease on it and this won't work.. my cursor doesn't even change into a hand...
Am I missing somthing here?

_root.createEmptyMovieClip("hosting_mc", 5);
loadMovie("../images/hosting.png", hosting_mc);

_root.hosting_mc.onRelease = function(){
getURL("http://www.mysite.com", "_blank");
}
trace(_root.hosting_mc) // --> this gives me "_level0.hosting_mc"

tia,
Bruno

OnRelease Function In A Generated Mc (createEmptyMovieClip)
Help!

I generated a new movie with CreateEmptyMovieClip. I would like to put a button function to this movie like a mouseup or onRelease or whatever. Anyone knows how I could do this, how to put a function to a mc created by AS?

Thank you for helping!
Philippe

How To: Change 'next.onRelease = Function()' To Delay
The below script functions perfectly to load .JPG's into an MC from an XML file.
However I would like to change the: next.onRelease = function()
to a delay of 10 seconds and then advance to the next image instead of using a next button.
can some one show me how to do this?
thanks
NYC.

info.text = "Loading...";
my_xml = new XML();
my_xml.ignoreWhite = true;
my_xml.load("images02.xml");
my_xml.onLoad = function(status)
{
if (status)
{
info_xml = this.firstChild.firstChild.childNodes;
// Create New Movie Clip
createEmptyMovieClip("mc", 1);
// Load picture into new MC
loadMovie(info_xml[0].attributes.source, "mc");
// Positioning
stageWidth = 700;
stageHeight = 420;
setPicture(mc);
}
else
{
}
};
next.onRelease = function()
{
// Next image
if (image < info_xml.length - 1)
{
image++;
loadMovie(info_xml[image].attributes.source, "mc");
info.text = info_xml[image].attributes.title;
setPicture(mc);
}
else if (image == info_xml.length - 1)
{
image = 0;
loadMovie(info_xml[image].attributes.source, "mc");
info.text = info_xml[image].attributes.title;
setPicture(mc);
}
};
/////////////
function setPicture(theMC)
{
this.onEnterFrame = function()
{
if (mc._width > 0)
{
mcWidth = mc._width;
mcHeight = mc._height;
mc._x = (stageWidth - mcWidth) / 2;
mc._y = (stageHeight - mcHeight) / 2;
// Text field with picture name
info.text = info_xml[0].attributes.title;
delete my_xml;
delete this.onEnterFrame;
}
};
}

Php Feedback Form Onrelease Function
Once the submit button is clicked for the feedback form, I want the form to be sent and then the form mc to go to and play the next frame in the scene. The form works fine but I cannot get it to play the next frame and make the form go away. Here is what I have for the button actionscript. Thanks!


on (release) {
if (!Email.length || Email.indexOf("@") == -1 || Email.indexOf(".") == -1) {
EmailStatus = "Invalid eMail";
} else if (!FirstName.length) {
EmailStatus = "Invalid Name";
} else if (!ToComments.length) {
EmailStatus = "No comments recorded";
} else {
loadVariablesNum ("form.php", "0", "POST");
EmailStatus = "Thank you.";
}
gotoAndStop ("Scene 3", 71);
}

[F8] Change OnRelease Function After Release?
Hi everyone,

I'm not really a actionscript expert, but I know this can be 'easily' done;
When clicking a button, a submenu slides out, using the tween classes.
I want the classes to revert when clicking the same button again.
How do I change the onRelease function of the button when it's clicked once?
This is my AS (on timeline) so far:


PHP Code:



stop();

producten_submenu.setMask(mask_producten);

import mx.transitions.Tween;
import mx.transitions.easing.*;

producten_but.onRelease = function() {
    // Wegwijzer
    var Wegwijzer:Tween = new Tween (_root.wegwijzer_mc,"_y",Regular.easeInOut,36,155,16,false);
    // Zoeken
    var Zoeken:Tween = new Tween (_root.zoeken_mc,"_y",Regular.easeInOut,77,204,16,false);
    // Masker Submenu    
    var Maskproducten:Tween = new Tween (mask_producten,"_yscale",Regular.easeInOut,0,80,16,false);
    
    producten_but.onRelease = function() {
        Wegwijzer.onMotionFinished = function() {
            this.reverse()
        };
        Zoeken.onMotionFinished = function() {
            this.reverse()
        };
        Maskproducten.onMotionFinished = function() {
            this.reverse()
        };
    }
}




Any help is very welcome!
Thanks

Copyright © 2005-08 www.BigResource.com, All rights reserved