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








OnRelease


I know I'm missing something very basic here, but...

I have a button, when the button is clicked I want scene 2 to play.

on (release) {
nextScene ();
}

My problem: It doesn't work. It all plays automatically.
Any help would be greatly appreciated!




FlashKit > Flash Help > Flash Newbies
Posted on: 06-27-2002, 12:59 PM


View Complete Forum Thread with Replies

Sponsored Links:

Button With 2 Functions? Onrelease=true, Onrelease=false
I have a button that uses a function to set the visibility of an mc. BUT it's called with an 'onrelease' and I would like the button to change the visibilty back to false on the next onrelease. Understand?
Here's my code:

list_btn.onrelease = function() {
playlist._visible = true;
}

Now I want to press the same button and have the mc (playlist) go back to false. I tried using some 'if' statements but just couldn't seem to get it right. My brain is just not working today.
Need some help please!

View Replies !    View Related
Where To Put OnRelease?
Hello!

I have a library with one button, which should simply open a page when the user clicks on it. I put the button from the lib to an empty clip.

The code in the OnRelease-function should be easy:

OnRelease()
{ getURL("/mypage.htm")
}

But where should I put the OnRelease-Function? In the button itself the actions are disabled.

Martho

View Replies !    View Related
OnRelease
can u make a movie clip do somthing on press and release...cuz flash says u can....and i do it the way it says but it dont work....if i go if(this.onRelease)(
gotoAndPlay(2)
)it should akt as a button rite??????i also have this code before the release....
onClipEvent (enterFrame) {
Mouse = _ymouse;
if (mouse<0) {
mouse = int(-1*mouse);
}
scale = int(200-mouse);
if (scale<100) {
scale = 100;
}
if (scale>200) {
scale = 200;
}
setProperty("", _yscale, scale);
}
???????????

View Replies !    View Related
OnRelease
Hi again.

I have a button...when I click it I duplicate another mc and startDrag(); That dragging mc has on(release) but since I never really clicked it, I just duplicated and started dragging, I can never stop Drag.

Is there a way to add a listenner to the root, that when a mouse is release, stopDrag()

Thanks

View Replies !    View Related
Onrelease
Almost got my animated button working. The Onpress part anyway.


Code:
knop.onPress = function() {
if (checktween != "aan")
gotoAndPlay("Klik");
}
}

knop.onRelease = function() {
if (_currentframe == 1 || checktween == "aan") {
checkrelease = "aan";
}
};
if (checkrelease == "aan") {
trace("gelukt");
checkrelease = "uit"; }
stop();
The Onpress part is working: it starts the "Klik" part. Which begins with Checktween="aan" and ends with Checktween="uit". But only if "Klik" isn't playing (using the Checktween var), otherwise it would jump back the "Klik"'s beginning.

I just can't get the Onrelease part working. Onrelease I want the Trace ("gelukt") action. This can be done immediately at frame 1 but if the playhead is somewhere between the "Klik" part, it first has to finish "Klik" before the Trace action is carried out. I thought about using the checkrelease var for that.

But you can see my problem: _currentframe works ok, and also during "Klik" checkrelease is set to "aan", but during "Klik" it has to finish it and then do the Trace part. Instead, during "Klik" it immediately does Trace.

Can someone correct my faulty code please

View Replies !    View Related
OnRelease Q?
I'm building a menu using dynamic text fields inside different MC's and I want it to be so that the button that corresponds to the active page is indented. So what I'm thinkinng is that first I make a function to enable all the buttons and reset their x value like so:

Code:
function reActivateBtns() {
myBtn.enabled = true;
myBtn2.enabled = true; //etc. . .
// some code for setting the "X" value?
}
Then I would make an onRelesae event that would first call the above function to reset all buttons and then disable that button and change it's "X" value like so:

Code:
myBtn.onRelease = function () {
reActivateBtns();
// some code for setting another "X" value
this.enabled = false;
};
I assume this would work but I am unsure as to what code I should use to change the X value. What should I put in place of the comments?

Secondly, I would like to add "onRollOver" and "onRollOut" code that would use actionscript to tween the indent/changed "X value" specified in the "onRelease" code. How would I go about doing that? I would really appriciate any help. thx in advance.

View Replies !    View Related
OnRelease
Ok, I have a movieclip in frame 2 and a button in frame 1.. how do i make it so when i click the enter button, it will play the movieclip in frame 2?

This is what i have so far

on (release) {
(What goes here??)
}

Thanks!!!

View Replies !    View Related
Onrelease Or What...?
I have created a button that shakes once, in the OVER state, but after I click it, it shakes again ( because I am still OVER the button ).
How can I stop this?

View Replies !    View Related
OnRelease
Hi,

I'm using this statement on a button in Flash 8:

launch_btn.onRelease=function() {
getURL("javascript:launch('http://test.com')");
}

and I get this error:

**Error** Symbol=txt12, layer=Layer 1, frame=1:Line 1: Statement must appear within on handler
launch_btn.onRelease=function() {

Total ActionScript Errors: 1 Reported Errors: 1

What am I doing wrong here?

View Replies !    View Related
[F8] OnRelease Help
Any ideas why I can't get onRelease to work? I basically want everything to stay put on release. Still kinda new to actionscript. File is attached if it helps.

l1.onPress = function () {
goleft ();
}

r1.onPress = function () {
goright ();
}

l1.onRelease = l1.onReleaseOutside = r1.onRelease = r1.onReleaseOutside = function () {
clearInterval (interval);
this._x = _xmouse;//trace("worked?");
}

function goleft () {
var interval = setInterval (stretchleft, 0);
}

function goright () {
var interval = setInterval (stretchright, 0);
}

function stretchleft () {
span = 20; // distance between snapping
xbounds = [50,r1._x - r1._width+135];
if(_parent._xmouse <= xbounds[0]){ // if to the left of the bounds
l1._x = xbounds[0]-135; // set to equal the far left bound
}else if (_parent._xmouse >= xbounds[1]){ // if to the right of the bounds
l1._x = xbounds[1]-135; // set to equal the far right bound
}else{ // otherwise set to a snap point using Math.round
l1._x = Math.round(_parent._xmouse/span)*span-135;
}
inv1._width = (r1._x + r1._width) - (l1._x + l1._width);
inv1._x = l1._x;
}

function stretchright () {
span = 20; // distance between snapping
xbounds = [l1._x + l1._width+135,500];
if(_parent._xmouse <= xbounds[0]){ // if to the left of the bounds
r1._x = xbounds[0]-135;
}else if (_parent._xmouse >= xbounds[1]){
r1._x = xbounds[1]-135;
}else{ // otherwise set to a snap point using Math.round
r1._x = Math.round(_parent._xmouse/span)*span-135;
}
inv1._width = (r1._x + r1._width) - (l1._x + l1._width);
inv1._x = l1._x;
}

inv1.onPress = function () {
_root.full1.startDrag (false, 10, 227, 350, 227);
}
inv1.onRelease = inv1.onReleaseOutside = function () {
_root.full1.stopDrag ();
}

View Replies !    View Related
OnRelease With XML?
I am trying to put together a drop-down menu which uses XML and ActionScript. However I am a Newb to Actionscript and XML and Im trying to figure this all out but I am having problems.
So here is the code I got:

Code:
var myEventListener:Object = new Object();
myEventListener.onRelease= function(args){
//Below are all the items passed when you click a button
//so, it appears you can just add to the xml and it will pick it up:
// just remove the comment lines then run the menu, click on anything
// and you see all the stuff that is accessible when any menu button is clicked
// all clicked buttons will fire this onRelease listener
/*
for(var i in args.item) {
trace(i+" ---- "+args.item[i]);
}
*/

//here i can just check for the "link" attribute in the xml
if(args.item.link) {
trace("found a link: "+args.item.link);
// here is where you could place your loadClip code to load the link swf
} else {
trace("no link attribute yet associated with this button")
}

}
treemenu.addEventListener("onRelease",myEventListener);
So far I understand that this locates the "link" with in the XML like so: <item title="Subtitle 1.1" link="yourswf.swf"/>.
So when I run the file in flash and click on a menu button I either get in the output box "youswf.swf" or I get an indication that the link is not the being "no link attribute yet associated with this button".

My queastion is now how do I go about creating the onRelease function to load "youswf.swf" in to the movie clip container on the page?

Sorry this is s drawn out for such a short queastion. Would really appriciate any advice or guidence.
Thanx

View Replies !    View Related
OnRelease Xml
Hi,

Right now I have a slideshow that is being loaded automatically with xml.
I'd like to instead have the slideshow only called if you click on one of the menu buttons on the top of the page.

So I want the xml category to be called when you release "collaboration".

How can I do this?

Thanks!!

View Replies !    View Related
OnRelease On Top Of An OnRelease
Is it possible to give an onRelease to a MovieClip, and then attach another onRelease to a part of that MovieClip?

What i basicly need to do, is a MovieClip that fades out when you click on any part of it, but in the middle i need to have some links, wich are defined in XML
The links are working perfectly, but the onRelease on the whole MovieClip overides all of them, is there any workaround on that ?

View Replies !    View Related
OnRelease Within For
I have an t.onRelease function withing my xml function here and when i call it i want to set the current instance to its own frame 2 (down state) and all the other instances to their own frame 1 (up state).

I have placed a this.gotoAndStop(2); to solve the down state requirement. But how do I reset all the other instances to frame 1?

Any help greatly appreciated guys and gals.

my code:

ActionScript Code:
xml.onLoad = function() {
        var nodes = this.firstChild.childNodes;
        numOfItems = nodes.length;
        for (var i = 0; i<numOfItems; i++) {
            var t = _root.attachMovie("image_btn", "image_btn"+i, i+1);
            t._x = tX;
            t._y = tY;
            tX += 60;
            if (tX>=Stage.width - 50) {
                tX = 10;
                tY += 50;
            }
            t.img = nodes[i].attributes.image;
            t.imgName = nodes[i].attributes.imageName;
            t.onPress = function() {
                tData.text = this.imgName;
                imageHolder.loadMovie(this.img);
            //
                this.gotoAndStop(2);
          //action here to set all other instances to fr1//
            };
        }
    };
    xml.load("images.xml");

//

View Replies !    View Related
OnRelease Help
... I can't for the life of me figure this one out.

I'm trying to write a portfolio section for my Flash website. So far I've got PHP to dump the values I need into a string that Flash can use using good ol' LoadVar.

Next I had it create a movieClip for each thumbnail.

Now I want it so that each of those movieClip (thumbnails) has an .onRelease = function() abillity.

I can't for the life of me figure it out !!!!

This is the AS so far :

Code:
// Prepare to load in data
// PortfolioMC.gallery_area.text ="Hello World!?";
// Prepare to load in data
myData = new LoadVars();
// Setup Movie Clip variable
var mc = this["imagePH"];
myData.load("http://www.tonycollings.com/swf/page_content/portfolio.php");
myData.onLoad = function(success:Boolean) {
mc.thumb_content.html = true;
mc.thumb_content.htmlText = "";
if (success)
{
var i
var picArray = new Array();
for (i=0; i<this.n; i++)
{
// Load the images into an array

picArray [i,0] = this["pic1"+i];
picArray [i,1] = this["pic2"+i];
var clip = imagePH.createEmptyMovieClip("clip"+i+"_mc", i);
clip.loadMovie(picArray[i,0]);
clip._x = 50;
// spacing
clip._y = i*150;
//trace(clip);
clip.onRollOver = function(){
getURL("http://www.google.com");
}
}
}
// Error Handling
else
{
mc.thumb_content.htmlText = "There would appear to be a problem with your internet connection. Please check it and refresh this page (CTRL+F5). Many Thanks";
}
};
stop();
Any ideas ?

The original FLA is here : http://www.tonycollings.com/swf/tonycollings.fl_

( Just rename the extension to .FLA, hosting company has something weird about allowing .FLA files to be uploaded. )

Any input would be greatly appreciated !

View Replies !    View Related
Onrelease
How do I put Onrelease and OnReleaseOutside code on the script below instead of onRollOVer and Out?

b1. onRollOver = over;
b1. onRollOut = out;


function over() {
this. gotoAndPlay(2);
}
function out() {
this. gotoAndPlay(11);
}

View Replies !    View Related
OnRelease....help
Code:
stop();
homeebut.onRelease = function() {
_root.gotoAndPlay ("1") }
equipebut.onRelease = function() {
door2.gotoAndPlay("equipefr") }
clientelebut.onRelease = function() {
door2.gotoAndPlay("clientefr") }
contactbut.onRelease = function() {
door2.gotoAndPlay("contactfr")
}
is this wrong? I can't seem to commence the MC (door2 which is in frame 2. of the timeline)

View Replies !    View Related
OnRelease OnRelease
Hiya peeps.

I finaly got the code I needed to change the colour of my background but it clearly needs altering. At the moment it works but I have to click the button twice for the colour to change. Now for once I see that this makes sense because I have onRelease twice!

This code is on the button:

on (release) {
home_btn.onRelease = function() {
var myColor:Color = new Color (this._root.background1);
myColor.setRGB(0xFF8844);}

However i'm unsure how to alter the code correctly....I assume the second onRelease needs to change to something else? I tried just:
home_btn = function() { but am really just guessing.

Anyone that could give me a heads up on this would be very much appreciated.
Thanks

View Replies !    View Related
Is OnRelease Possible?
I need an easy way of doing this if its even possible, but I have an MC with a button inside of it. Is it possible to give that button actions in the main timeline... like if it were a MC you would put:

buttonMC.onRelease = function():Void{
gotoAndPlay(whateverframe);
}


but can you assign that button onRelease functions using actionscript in the main timeline??? I have the regular button in the MC doing onRollover functions but I need to be able to give it actions of what to do on onRelease, but I don't konw how or if its possible. The reason being that I have a bunch of actions and frames, but it makes the work load a SINCH if this is possible. So someone please help!

View Replies !    View Related
OnRelease
How do I put Onrelease and OnReleaseOutside code on the script below instead of onRollOVer and Out?
contact. onRollOver = over;
contact. onRollOut = out;


function over() {
this. gotoAndPlay(2);
}
function out() {
this. gotoAndPlay(3);
}

View Replies !    View Related
OnRelease
Hello
The following code works good except for the item.onRelease function.
I don't see why it won't work.
I even put a trace(this); and that trace is never being executed. Therefore,I assume that the onRelease event is not even being handled.
Is anything wrong with that function?

Thanks!
Keehun

Code:

import flash.filters.GlowFilter;
Stage.scaleMode = "noScale";
Stage.align = "TL";
var numOfItems:Number = 20;

onEnterFrame = function() {
for(var i=0;i<numOfItems;i++) {
   var item:MovieClip = this.attachMovie("item","item" + i,i+1);
   item._x = 0;
   item._y = 60 * i;
   item.text.text = i;
   item.onRollOver = function() {
      var num:String = this.text.text;
      var glow:GlowFilter = new GlowFilter(0x93a056);
       this.gotoAndStop("over");
      this.text.text = "Button " + num;
      this.filters = [glow];
      }
   item.onRelease = function() {
      trace(this);
      var num:String = this.text.text;
      this.gotoAndStop("click");
      this.text.text = "You Pressed on: " + num;
   }
}
}

View Replies !    View Related
On(release) Vs OnRelease
Hey guys whats the difference b/n on(release) vs onRelease

View Replies !    View Related
MyMovieClip.onRelease
hi

i used this loop to declare every movieclip in an array as a button:

for(i=0; i<theArray.length; i++){
_root["myMovieClip" add i].onRelease = function () {
_root.theReleasefunction();
}
}

but the function only appears to work on the last moieclip (i=theArray.length)

what can i do????

please help

View Replies !    View Related
OnRelease With Attached MCs
I am trying to put onRelease actions onto multiple attached MC's. I give each
attached clip the variable name imageItem. Farther down I call imageItem.onRelease. This only works for the last attached clip? I have done this before and it worked on all the clips. I am deperate, can anyone help??

This function is called multiple times from another function. I can add all the code if needed.

Thanks

(sorry, code tags don't seem to work?)


function populateImages() {
// number of items
if (imageCounter<imageLen && imageCounter<maxImages) {
// attach image container
imageItem = _root.attachMovie("image", "image"+imageCounter, imageCounter);
imageItem._alpha = 0;
imageItem._x = 10+Math.floor(imageCounter%5)*65;
imageItem._y = 10+Math.floor(imageCounter/5)*65;
image = navXML.firstChild.childNodes[XMLcounter].attributes.id;
// load image
_root["image"+imageCounter].loadMovie(image);
// attach loading bar
preloadbar = _root.attachMovie("loadbar", "loadbar"+imageCounter, imageCounter+1);
preloadbar._x = 10+Math.floor(imageCounter%5)*65;
preloadbar._y = 10+Math.floor(imageCounter/5)*65;
// loop loader()
this.onEnterFrame = loader;
} else {
butts();
}
// HERE'S THE PROBLEM!!!!!
imageItem.onRollOver = function() {
//imageSelected = this;
trace(this);
};
}

View Replies !    View Related
OnRelease ... Multiple Use
I have made a brief animation using the onRelease action (Mx) which I applied on a MC. What I tried was to have a second MC respond to the actionscript, but this doesn't seem to work.

Look at the products link in the movie hereunder, you'll see the MC of the man move along the gallery when the images are pressed. The Woman, however, while using the same script doesn't move.

http://www.cibusintl.com/cib.html

Here's the script :

onClipEvent (load) {
_x = 260;
_y = -5;
target_xscale=100;
target_yscale=100;
easespeed=15;
div = 15;
}
onClipEvent (enterFrame) {
_x += (endX-_x)/div;
_y += (endY-_y)/div;
_xscale += (target_xscale-_xscale)/easeSpeed;
_yscale += (target_yscale-_yscale)/easeSpeed;


_root.ovidias.onRelease = function() {
endX = 30;
endY = 0;
target_xscale=100;
target_yscale=100;
};
_root.neuhaus.onRelease = function() {
endX = -125;
endY = 15;
target_xscale=90;
target_yscale=90;
};
_root.cacaote.onRelease = function() {
endX = -270;
endY = 38;
target_xscale=70;
target_yscale=70;
};
_root.chocmod.onRelease = function() {
endX = -360;
endY = 55;
target_xscale=55;
target_yscale=55;
};
_root.mondose.onRelease = function() {
endX = -420;
endY = 74;
target_xscale=40;
target_yscale=40;
};
_root.delafaille.onRelease = function() {
endX = -470;
endY = 88;
target_xscale=25;
target_yscale=25;
};
}

Why can't I use the above script on two seperate MC's ?

Cheers,
Smalco

View Replies !    View Related
OnRelease And GetUrl
I'm a newbie to all of this actionscripting in Flash.

What I'm trying to do is have a button onRelease get a website.
I don't quite understand the error message I'm getting.

It says: Statement must appear within on handler.

Can someone tell how to code this to goto www.canoe.ca??

View Replies !    View Related
OnRelease Don't Run Til When Click On
movieClip.onRelease = function doesn't seem to run until when you click on the movieclip during runtime. I attached onRelease function to a array of buttons within a loop. And I used the loop counter within the onRelease function. The values for the loop counter don't seem to work, or exist anymore. Have anybody had this problem or anybody who knows a way around it? And help will be great.

View Replies !    View Related
OnRelease Command H E L P
i'm a little lost,

can you use a path of movie clips to track a " onRelease " comand? i.e. :

nav1.firmDropUp.overviewBotton.onRelease = function() {
linkVariable = "OVERVIEW";
_root.gotoAndStop("firmFrame");
}

much thanks,
brad

View Replies !    View Related
OnRelease Easing A Mc ?
hello .i have a btn and a mc.
this is what i am trying to accomplish .
onRelease
move a mc to a _x,_y location smoothely.just just the rapid movement i am getting now ..
""snappy movement" thanks for any help ..

View Replies !    View Related
Defining OnRelease Twice?
Can i add an onRelease function to a button that has already has an onRelease function defined elsewhere in the script ?

My 5 buttons were created and defined from within a for loop. The buttons animate on a onRelease function within this loop. So thats all fine and dandy, i have a navigation bar that kinda works, but now i want to add content with attachMovie for each button without adding more script to my for loop.

G

View Replies !    View Related
OnRelease Command
I am trying to command a "click" in actionscript for a button. My code works fine when it's a movieclip, but not when it's a button.


Code:
function clickButton(button_name){
eval(button_name).onRelease();
}

// somewhere else
clickButton("btn");
clickButton("mc");
In this situation, the mc does what it's supposed to, but the btn does not. Is there anything different I need to do for buttons?

Thanks

View Replies !    View Related
Masks And OnRelease
I'm having this weird problem with Flash MX.

I have two movie clips that are just rectangles of color. One movie clip is named box1 and the other is named box2.

I have the following actionscript on the timeline:

box1.onRelease = function( ) {
trace('box1');
}

box2.onRelease = function( ) {
trace('box2');
}

If neither box is a mask, both events fire. If I change box1 into a mask, the events on each box still work. If I also change box2 into a mask, the event on box1 does not fire but the event on box2 does.

Can anyone help me with this?

View Replies !    View Related
OnRelease? Mc Width?
Hey. I'm having a really hard time controlling the position of a movie clip. Basicly the movie is a little gallery, where i click on a thumbnail and it loads an image. Its dynamic in the sense that it loads image names and paths from an XML file.

Anyway, when i click on a thumbnail, the onRelease event is called and loads the desired image into a movie clip called loader (works as a container). Thats workin fine. Problem is I NEED to to align the images to the right, since most of the images have diferent sizes. By default they get loaded to match the top left corner to the top left corner of the containing movie clip.

code looks something like:

thumbHolder.onRelease = function() {
loadMovie(this.main,loader);
loader._x = 396 - loader._width;
};

Here's whats weird. It'll work only if i click on the image a second time. From what i could tell through the debbuging, the mc loader's width is only updated after the onRelease event finishes. And therefore the second line of code in the event handler doesn't work.

Any one knows how to do this?????

View Replies !    View Related
Mc.onRelease Not Working?
I am puzzeled as to why my onRelease function isn't working. I have tried a couple different codes but it doesn't seem to work. I have a moivieclip in the library that I call pdf_icon and I set the linkage for export and used the same name. I tried different levels thinking that was the issue. but I don't know anymore.
Here is my code

PHP Code:



_root.stop();
////////////////////////// LOAD ID txt FILE //////////////////////////////////
MyLoadCID = new LoadVars();
MyLoadCID.load("CdTypes/ID.txt");
MyLoadCID.onLoad = function(success) {
    if (success) {
        myVar = MyLoadCID.ID;
        info(myVar);
    } else {
        trace("not loaded");
    }
};
//////////////////////////// START FUNCTION INFO ////////////////////////////////
function info(myVar) {
    //trace(myVar);
    MyLoadVars = new LoadVars();
    MyLoadVars.load("CdTypes/"+myVar+"PORTFOLIO.txt", "Pdfs");
    MyLoadVars.onLoad = function(success) {
        if (success) {
            //trace("done loading");
            //////////////// show video choices in text boxes /////////////////////////////////////////    
            for (i=0; i<5; i++) {
                            _root.attachMovie("pdf_icon", "pdf_mc"+i, 60+i);
                            _root["pdf_mc"+i].loadMovie("images/"+this["logo"+i]+"");
                            _root["pdf_mc"+i]._x = 0;
                            _root["pdf_mc"+i]._y = 50+(i*100);
                            ////////////////// on click /////////////////////////////////////
                            _root["pdf_mc"+i].onRelease = function() {    
                                trace("this button working");                    
                            };
                        }
            /*for (i=0; i<5; i++) {
                var pdfMC = _root.attachMovie("pdf_icon", "pdf_mc"+i, 10+i);
                pdfMC.loadMovie("images/"+this["logo"+i]+"");
                pdfMC._x = 0;
                pdfMC._y = 50+(i*100);
                ////////////////// on click /////////////////////////////////////
                pdfMC.onRelease = function() {
                    trace("this button working");
                };
            }*/
        } else {
            trace("not loaded");
        }
    };
}

View Replies !    View Related
Applying OnRelease
I'm getting there slowly. Can somebody help me with another simple one? I can't seem to pass anything into an onRelease function. Here's what I have ....
code:
for (j=0; j<obj[i].val.length; j++) {
var tab_mc = menu_mc.attachMovie("tab", obj[i].val[j].id, j);
//apply text to tabs
var tabTxt = obj[i].val[j].text;
tab_mc.tab_txt.text = tabTxt;
//set tab state
if (j>0) {
tab_mc.gotoAndStop("inactive");
}
//set tab actions
tab_mc.onRelease = function() {
tab_mc.gotoAndStop("active");
}

I'm assigning text, actions etc to a set of menu tabs. The part where I make the tabs inactive works. But this ....
code:
tab_mc.onRelease = function() {
tab_mc.gotoAndStop("active");
}

.... has problems. I had advice on a similar problem yesterday. Either this one has a different solution or I don't understand what's going on fully. Can someone please tell me how to get this working, and maybe explain why it doesn't work in this way?

thanks
mark

View Replies !    View Related
Assigning OnRelease To A MC?
I try to assign a function to a MovieClip which holds a image.
When playing the movie, the images are shown, but the buttons are not working. What's wrong?

My code:

code:
pic = _root.attachMovie("picItem", "picItem"+j, j);
pic._x = 100*j;
pic._y = 0;
pic.loadMovie(get_property("archive_"+lala+"_galle ry", "thumbnail", j));
pic.onRelease = function() {
play();

View Replies !    View Related
OnRelease Not Releasing...
Hey guys, stupid Flash Newguy here lookin for some help. I'm just working through a tutorial at quickcert.com I am simply trying to create text links that when you click on a different one a different image appears. I've followed the tutorial as close as possible but the problem is, the tutorial is in MX and i'm using MX 2004. I'm assuming there are several differences as I've had to search around for some of the features they are talking about.

Anyways...when testing the movie instead of showing the links...it plays through the entire thing.

My setup is like this.

I have each Link converted to a symbol and on a seperate layer. On the first frame of each of their layers I have an onRelease that and a gotoandStop command that tells it to go to the frame of the layer that contains it's corresponding image. However, when I test it...like I said...instead of going to and Stoping, it just loops through it.

I'm by no means a flash expert but if somebody could tell me why it's doing this that would be awesome. I'm sure it's something simple that I just don't know to check.

Thanks

View Replies !    View Related
For() OnRelease() Problem
k here's an example of my problem:

[code]
for(i=0;i<15;i++){
duplicateMovieClip("my_mc", "my_mc"+i, i);
this["my_mc"+i].onRelease = function(){ trace(i); }
}

the click works, only problem is that no matter how many itmes it duplicates, when u clicked on ANY of them, it returns "15"

anybody know a way around this? ive ran into this problem before just not sure what i did to fix it

View Replies !    View Related
Guidance For MC.onRelease + IF/Else
Hello Everyone,

I need a bit of help with If/Else statements. I have a site here so you can refer to the issue i'm about to show you.

When the browser is rescaled..i have it so the logo in the middle stays centered.

however, if you rescale your browser so much so that the logo hits the coordinate of (100, 100)...it stays there.

My question is - How do i set up the if statement to say...

if button press = false, then keep logoMC centered...
and
if button press = true perform the function (the slide)
and don't keep it centered upon rescale of browser.

the code i'm using is below its a simple work around that says:
when logo has x and y coordinates above 100,100..keep it centered...

the problem is..you can scale your browser till the logo is actually at 100,100...so it will stay there once it reaches....(but it shouldn't do that unless the button has been clicked)

Thanks in advance

code:
#include "mc_tween2.as"
stop();
container.loadMovie("http://www.planetlucid.com/test.swf");
Stage.scaleMode = "noScale";
Stage.align = "LT";
var sl:Object = new Object();
sl.onResize = function() {
bottombar._width = Stage.width;
bottombar._x = 0;
bottombar._y = Stage.height;
copyright._x = 0;
copyright._y = Stage.height;
if (logo._x>100) {
logo._x = Stage.width/2;
logo._y = Stage.height/2;
motiv._x = Stage.width/2;
motiv._y = Stage.height/2;
}
if (logo._y>100) {
logo._x = Stage.width/2;
logo._y = Stage.height/2;
motiv._x = Stage.width/2;
motiv._y = Stage.height/2;
}
};
Stage.addListener(sl);
sl.onResize();

View Replies !    View Related
OnRelease Move To?
Hi Guys,

Ok i have got a movie clip which when pressed will drag out to a certain possition. Here's the script i have used on the movie clip

on(press){
startDrag("_root.mytext", false, -646, 0, -82, 0);
}
on(release, rollOut, releaseOutside){
stopDrag();
}

What would i have to do to this so when the movie is released it moves with easing back to it's starting position? (which would be -646)

Thanks for for your time
T

View Replies !    View Related
Dynamic OnRelease
Ok, so I am addig unknown number of JPG's from an XML file...I have this code to get them in and position them. But I need to set an onRelease event for them, and THIS isnt working...can anyone see whats wrong?


Code:
function loadGallery(){
//trace(_global.image_total);
for(i=1; i<=_global.image_total; i++){
_root.SLIDE1.CONTENT3B.createEmptyMovieClip(("image"+i), i);
_root.SLIDE1.CONTENT3B["image" + i].loadMovie("ART_THUMBS/" + _global.Ithumbnail[i-1]);
if (i % 2 == 0){
//EVEN
_root.SLIDE1.CONTENT3B["image" + i].slideTo(10, 40 + 55*i - 55);
}else{
//ODD
_root.SLIDE1.CONTENT3B["image" + i].slideTo(120, 40 + 55*i);
}
_root.SLIDE1.CONTENT3B["image" + i].onRelease = function() {
shuffleBARS();
};
}
}

View Replies !    View Related
Fade Out Swf OnRelease
I have a container movie with 5 buttons, once a button is clicked it loads an external swf into the container movie. That works fine but I want the button to unload the current movie before it loads the new swf, how is this done? Thanks!

View Replies !    View Related
Using OnRelease In A Class
Hello,
Can anybody tell me why the trace returns Undefined in the following piece of code?


Code:
class myClass {

private var anMc:MovieClip = someMc;

//CONSTRUCTOR HERE {

buttonActivate();

}

private function buttonActivate():Void {
myMc.myUpButton.onRelease = function(){
this._parent.setAction();
}

private function setAction():Void{
trace(anMc._x)
}
}
Thanks

View Replies !    View Related
OnRelease Oddity.
I'm having problems with an onRelease function seemingly being called twice.
Even more confusingly, the _root.slidetime 1000000 value acts as a pause - but trace value is returned as 'Play' and then 'Paused' although the pause affect works - but the un-pause effect I'm after is not happening.

Can someone see why this may be happening (snippet of larger code attached)?


PHP Code:



pause_button.onRelease = function() {
    trace ("Root Time = " + _root.time);
    if (slideshowpause == false){
        slideshowpause = true;
        _root.slidetime = _root.time;
        trace ("Play");
    }
    if (slideshowpause == true){
        slideshowpause = false;
        _root.slidetime = 1000000;
        trace ("Paused");
    }    
};




As a note, the slideshowpause value is set to false when the movie loads, and the following code on a seperate frame does all the work:


PHP Code:



for(var i=1; i<=numImages; i++){

    if(i == _root.currentImage){

        if(_root.images_mc_container.images_mc["image_dropzone" + _root.currentImage].getBytesLoaded() >= _root.images_mc_container.images_mc["image_dropzone" + _root.currentImage].getBytesTotal()){

            _root.imagesCached = true;

            if(_root.images_mc_container.images_mc["image_dropzone" + _root.currentImage]._height > (_root.movie_height - 20)){

                var percent = 100 * ((_root.movie_height - 20) / _root.images_mc_container.images_mc["image_dropzone" + _root.currentImage]._height);
                _root.images_mc_container.images_mc["image_dropzone" + _root.currentImage]._yscale = percent;
            }
            
            if(_root.images_mc_container.images_mc["image_dropzone" + _root.currentImage]._width > (_root.movie_width - 20)){

                var percent = 100 * ((_root.movie_width - 20) / _root.images_mc_container.images_mc["image_dropzone" + _root.currentImage]._width);
            }

            if(_root.imageShown == 0 && _root.currentImage != _root.oldImage){

                _root.images_mc_container.images_mc["image_dropzone" + _root.currentImage]._visible = true;
                _root.images_mc_container.images_mc["image_dropzone" + _root.currentImage]._alpha = 0;
                _root.imageShown = 1;
                
            } else {

                if(_root.currentImage != _root.oldImage && _root.fade > 0){

                    _root.images_mc_container.images_mc["image_dropzone" + _root.currentImage]._alpha = 100 * (_root.counter / (_root.fade * _root.second));

                } else {

                    _root.images_mc_container.images_mc["image_dropzone" + _root.currentImage]._alpha = 100;
                }
                


                _root["tag" + _root.currentImage] = xmlData.slideshow[1].images[i-1].image[1].caption.value;
            }
            
        } else {
            _root.images_mc_container.images_mc["image_dropzone" + i]._visible = false;
        }
        
    } else if(i == _root.oldImage && _root.fade > 0){

        _root.images_mc_container.images_mc["image_dropzone" + _root.oldImage]._alpha = 100 - (100 * (_root.counter / (_root.fade * _root.second)));

    }  else {
        _root.images_mc_container.images_mc["image_dropzone" + i]._visible = false;
    }
    tag = _root["tag" + _root.currentImage];
    picture_tag(tag)
}

_root.counter++;

_root.counterLimit = ((_root.slidetime + _root.fade) * _root.second);


function nextImage(){
    if(_root.counter > _root.counterLimit){
        _root.counter = 0;
        _root.oldImage = _root.currentImage;
        _root.currentImage++;
        if(_root.currentImage > numImages){
            if(_root.repeat == "true"){
                trace ("Repeat Slideshow");
                _root.currentImage = 1;
            } else {
                _root.currentImage = _root.numImages;
            }
        }        
        _root.imageShown = 0;
        images_mc_container.play();
    }
}

function prevImage(){        
    if(_root.counter > ((_root.slidetime + _root.fade) * _root.second)){        
        _root.counter = 0;
        _root.oldImage = _root.currentImage;
        _root.currentImage--;
        if(_root.currentImage < 1){
            if(_root.repeat == "true"){
                trace ("Repeat Slideshow");
                _root.currentImage = _root.numImages;
            } else {
                _root.currentImage = _root.numImages;
            }
        }        
        _root.imageShown = 0;
        images_mc_container.play();
    }    
}

function picture_tag(tag) {
    _root.caption_mc.createTextField("tag_text", 1, 24, 282, 270, 100);    
    tag_format = new TextFormat();
    tag_format.color = 0xffffff;
    tag_format.font = "Arial";
    tag_format.size = 18;
    _root.caption_mc.tag_text.embedFonts = true;    
    _root.caption_mc.tag_text.multiline = true;
    _root.caption_mc.tag_text.wordWrap = true;
    _root.caption_mc.tag_text.autoSize = true;
    _root.caption_mc.tag_text.html = true;
    _root.caption_mc.tag_text.selectable = false;
    _root.caption_mc.tag_text.border = false;
    _root.caption_mc.tag_text.htmlText = tag;
    _root.caption_mc.tag_text.setTextFormat(tag_format);
    _root.caption_mc.tag_text._y = ((mask._height - _root.caption_mc.tag_text._height) - 20);
    picture_h2();    
}

function picture_h2() {
    if (_root.counter == 1){
        if (_root.caption_mc.tag_text.htmlText == ""){
            if (h2.placement != "everywhere"){
                h2.gotoAndPlay("everywhere");
                _root.caption_mc.tag_text.htmlText = "";
            } else {
                h2.gotoAndPlay("anywhere");
                _root.caption_mc.tag_text.htmlText = "";
            }
        } else {
            h2.gotoAndStop("nowhere");
        }
    }
}

if (slideshowpause == false){
    nextImage();
}


if (_root.imagesCached == true && firstImageLoaded == false){
    firstImageLoaded = true;
    images_mask.gotoAndPlay(2);
    images_mask_border.gotoAndPlay(2);
}

previous_button.onRelease = function() {
    if (slideshowpause == false){
        _root.counter = (_root.counterLimit + 1);
        prevImage();
        gotoAndPlay(5);
    } else {
        _root.counter = (_root.counterLimit + 1);
        prevImage();
        gotoAndPlay(5);
    }
};
next_button.onRelease = function() {
    if (slideshowpause == false){
        _root.counter = (_root.counterLimit + 1);
        nextImage();
        gotoAndPlay(5);        
    } else {
        _root.counter = (_root.counterLimit + 1);
        nextImage();
        gotoAndPlay(5);
    }            
};
pause_button.onRelease = function() {
    trace ("Root Time = " + _root.time);
    if (slideshowpause == false){
        slideshowpause = true;
        _root.slidetime = _root.time;
        trace ("Play");
    }
    if (slideshowpause == true){
        slideshowpause = false;
        _root.slidetime = 1000000;
        trace ("Paused");
    }    
};




Some help sorting this oddity would be much appreciated.

View Replies !    View Related
OnRelease Works Sometimes, Not Others ?
I'm working on a game but am running into trouble. I have a type of "button" that is really a movieclip that once released, plays a certain frame label within another movieclip. However, the button only works SOMETIMES when I test the movie. Using Flash 8 Pro with the latest Flashplayer. I'm kind of new to actionscripting.

The button-like movieclip has an instance photo01. Within the linked movieclip (instance name narration) I have a frame label "photo_look". (It just has some text describing photo01, nothing fancy.

I have this actionscript for the first frame of the first scene on the main timeline:

Code:
stop();
photo01.onRelease = function(){
narration.gotoAndPlay("photo_look");
}


Like I said, narration SOMETIMES works when you click on photo01.

View Replies !    View Related
[F8] OnRelease After CreateEmptyMovieclip
Hi,

I want to add an onRelease function to my newly created movieclips but that doesn't work:

Code:
function load_pict(i, thumb, big){
_root.createEmptyMovieClip("loader"+i, i);
_root["loader"+i]._x = i*75;
//trace(_root["loader"+i]);
_root["loader"+i].loadMovie(thumb);
_root["loader"+i].onRelease = function(){
load_mc.loadMovie(big);
};
}
No hand cursor appears and the movieclips with the loaded pictures are clickable. This function is called mutiple times (10 for now).

Hope someone can point me in the right direction. Thanks a lot in advance.

View Replies !    View Related
[F8] OnRelease & OnReleaseOutside
I had a problem with this droptarget. It seemed that sometimes the mc that was moved didnīt get stuck even if it was over the target. I figured out if the onRelease was to fast so it was more like an onReleaseOutside. I tried to use both but couldnīt find the right way. I solved it in another way for the moment but want to know how to solve it.

Hereīs the code.

---

_root.vag.sak4.onRelease = function(){
this.stopDrag();
if(eval(_root.vag.sak4._droptarget) == _root.vag.skal1 ){
_root.s4a = 12;
_root.s4b = 0;
}else if(eval(_root.vag.sak4._droptarget) == _root.vag.skal2 ){
_root.s4b = 12;
_root.s4a = 0;
}else{
_root.vag.sak4._x = punk4x;
_root.vag.sak4._y = punk4y;
_root.s4b = 0;
_root.s4a = 0;
}
}

View Replies !    View Related
[MX04] OnRelease Help- Where To Put It?
Hello, I'm working on my very first site and therefore am new to every aspect of Flash. I've figured out a number of things but am now stumped:

I've created some buttons which now have little rollover movies that play for each of them. I'm now trying to go to a certain frame in the main timeline (frame_ab) when these same icons are clicked. I'm trying this code (contact1 is the button instance- should I use the button name instead?):

contact1.onRelease =
_root.gotoAndPlay("frame_ab")

I'm not sure if I've even got that right, but secondly can't figure out where to put it (the code)? Not in the four frames of the button itself, I figure, and it doesn't seem to work putting it in the main timeline of the specific button. I'm sure I am missing out on some fundamental issues here. Your help is appreciated!

View Replies !    View Related
[F8] Fade Out With OnRelease
Hi,
I'm sure there's a thread on this somewhere but I haven't found the exact match yet for what I'm trying to do. I'm designing a web site and all I want the home page to do is fade out (in 3 separate pieces) when I click on any one of the 8 pages from the nav. I would use ActionScript for this, right?

thanks.

View Replies !    View Related
[F8] OnClick/OnRelease
how do I add onclick events to MCs or Dynamic Text Fields

View Replies !    View Related
[F8] LoadMovie And Using OnRelease
Hello!

Straight to the point, this code does not render as clickable (shows the JPEG fine):


Code:
_root.createEmptyMovieClip("test", 1);
loadMovie("loveinhkthumb.jpg", _root.test);
_root.test.onRelease = function() {
trace(1);
};
And this one shows it only goes through 1 frame:


Code:
_root.createEmptyMovieClip("test", 1);
loadMovie("loveinhkthumb.jpg", _root.test);
_root.test.onEnterFrame = function() {
trace(1);
};
I have gotten buttons as external JPEGs to work before I just do not remember how... Haven't programmed actionscript in a long time.

Thank you, if anybody can simply tell me how to fix it it would be very helpful,

Michael

View Replies !    View Related
Copyright Đ 2005-08 www.BigResource.com, All rights reserved