?
Solved

Actionscript for FLash to Fadein larger pics on MOUSE DOWN.  500 POINTS!!

Posted on 2004-11-18
11
Medium Priority
?
223 Views
Last Modified: 2010-04-07
I have the followin flash at http://homepages.nyu.edu/~bjv211   The FLA is http://homepages.nyu.edu/~bjv211/slide_rev.fla  .  I would like the photos to enlarge when you click on them and then go back when you click again.  Any thoughts!!!  thanks
0
Comment
Question by:bjv211
  • 4
  • 3
  • 2
  • +1
11 Comments
 
LVL 14

Expert Comment

by:trigger-happy
ID: 12624506
Hello bjv211,
        Have you tried using the _xscale and _yscale property of the movie clip? You can have it something like this:

on(press){
      if(_global.sized == 0){
            this._xscale = 100;
            this._yscale = 100;
      }else{
            this._xscale = 80;
            this._yscale = 80;
      }
}

try using that, you can change it to suit your needs.

--trigger-happy
0
 
LVL 14

Expert Comment

by:trigger-happy
ID: 12624511
Oops, i forgot

on(press){
      if(_global.sized == 0){
            this._xscale = 100;
            this._yscale = 100;
            _global.sized = 1;
      }else{
            this._xscale = 80;
            this._yscale = 80;
            _global.sized = 0;
      }
}
0
 
LVL 16

Expert Comment

by:vickerleung
ID: 12633463
It is better to initialize the variable before use

Add this line beforehand

_global.sized = 0;

Vicker
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:bjv211
ID: 12636268
My flash file has moved...you can download my fla from http://homepages.nyu.edu/~bjv211/slide.fla   I am trying to use the fadin and fadeout functions I defined in Scene1 layer actionscript on each movieclip when I click.
0
 
LVL 16

Expert Comment

by:vickerleung
ID: 12641730
bjv211,

Change this:

onClipEvent (mouseDown) {
      fadein(pic4_big);
}

to

onClipEvent (mouseDown) {
      _root.fadein(pic4_big);
}

See if it helps~~ :)

Vicker
0
 
LVL 16

Expert Comment

by:vickerleung
ID: 12641784
bjv211,

sorry~
It should be

onClipEvent (mouseDown) {
     _root.fadein(_root.pic4_big);
}

That would be safer

However I found that the fade in function don't work
in this line

target.onEnterFrame = function()

I am thinking why is it like that~

Vicker
0
 
LVL 27

Accepted Solution

by:
negatyve earned 2000 total points
ID: 12644262
Your functions don't work because you are exporting your movie for the flash 5 player, while onEnterFrame syntax is valid from flash player 6+...
Follow me:

- create an empty movieclip in the first frame of your movie main timeline
- give it the instance name "fader"
- create inside it 5 empty frames:

1 frame script (no label):
// =============
stop();
// =============

2 frame (labeled "fadeout");
// =============
if(this.target._alpha > 0){
      this.target._alpha -= 6;
} else {
      this.gotoAndStop(1);
}
// =============

3 frame (no label);
// =============
gotoAndPlay("fadeout");
// =============

4 frame (labeled "fadein");
// =============
if(this.target._alpha < 100){
      this.target._alpha += 6;
} else {
      this.gotoAndStop(1);
}
// =============

5 frame (no label);
// =============
gotoAndPlay("fadein");
// =============


- change the script in the first frame of the main timeline to:

// ======================================
fscommand ("allowscale", "false");
      title = new Array(...)
      subtitle = new Array(...);
function getinfo(num) {
      out.title = title[num];
      out.subtitle = subtitle[num];
}
function getstandby () {
      out.title = "Ben '&' Lauren";
      out.subtitle = "2004";
}
function fadeout(target) {
      fader.target = target;
      fader.gotoAndPlay("fadeout");
}
function fadein(target) {
      fader.target = target;
      fader.gotoAndPlay("fadein");
}
this.camera._alpha = 15;
this.pic4_big._alpha = 0;
// ======================================


- change the button script to:

// ======================================
onClipEvent (mouseDown) {
      if (this.over) {
            _root[this.zoomed ? "fadeout" : "fadein"](_root.pic4_big);
            this.zoomed = !this.zoomed;
      }
}
// ======================================
0
 
LVL 1

Author Comment

by:bjv211
ID: 12645823
Oh negatyve, you amaze me once again, and thanks to everyone else for getting this going...Negatyve you rock
0
 
LVL 1

Author Comment

by:bjv211
ID: 12650661
ok Negatyve, sorry to jump to conclusions, at first glance the fading was working, however if I click anywhere on the bar of movieclips the same picture comes up, it is not recognizing individual clips I assume?
0
 
LVL 27

Expert Comment

by:negatyve
ID: 12652114
I didn't know what kind of effect you are exactly trying to achieve. You want to fadein the proper image at the first click on the proper thumb, and then.....?
0
 
LVL 1

Author Comment

by:bjv211
ID: 12654077
thats correct and then fadeout on second click. To recap:  The movie scrolls, the user clicks once on the image, it fades in the larger image and remains until the user clicks again?
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
Suggested Courses
Course of the Month15 days, 13 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question