• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Simple button to Image Display

Community Beginner ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

Hi,

 

I swear if Fireworks were still around I'd already be done. I'm not a programmer, little experience with Animate, not even sure if this is the right application. I want to have eleven buttons, names of men killed in WWI on a plaque in my church, and when the user clicks on the button, the man's photo is displayed. 

 

I can get Animate to briefly display the photo but not hold the photo until the next button click. Or the photo is stuck and won't go away.

 

I'm really frustrated. I need to get this done for the upcoming anniversary of the plaque installation...any help would be appreciated. Thanks!

Views

276

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

html5/canvas or as3.?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

HTML5 please

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

create an array of the 11 vet names:

 

var vetA = ["Sam Gold", "Robert Alprin", etc ];

 

import all 11 images corresponding to the vets and assign links to each pic using the following convention, firstname_lastname.  eg, Sam_Gold, Robert_Alprin etc

 

create a movieclip with a textfield wide enough to accomodate the longest vet name without a line break.  assign an instance name of tf to the textfield and assign a linkage id of tf_mc to the movieclip.

 

use the following script:

 

var vetA = ["Sam Gold", "Robert Alprin", etc ];

// pick whatever initial values suits your esthetics

var mcY = 50;  // first vet name y

var mcX = 30; // all vet names y position

var picX = 300;  // all pics x

var picY = 50;  // all pics y

 

/////////////////////////////////////////////////

// end user defined variables //

////////////////////////////////////////////////

 

for(var i=0;i<vetA.length;i++){

this["mc"+i] = new lib.tf_mc();

this["mc"+i].x = mcX;

this["mc"+i].y = (i+1)*mcY;

this.addChild(this["mc"+i]);

this["mc"+i].name = i.toString();

this["mc"+i].addEventListener("click",clickF.bind(this));

 

this["pic"+i] = new lib[vetA[i].split(" ").join"(_")];

this["pic"+i].name = "pic_"+i;

this["pic"+i].x = picX;

this["pic"+i].y = picY;

}

 

function clickF(e){

for(var i=0;i<vetA.length;i++){

if(this.getChildByName("pic_"+i).stage){

this.removeChild(this.getChildByName("pic_"+i));

break;

}

}

this.addChild(this.getChildByName("pic_"+e.currentTarget.name));

}

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

Thanks. I have 11 buttons ("dickey_button" etc.) corresponding to the men in the screen cap attached. I would like the user to click on each name on the plaque and their memorial image would pop up to the left. Would your script work in this case?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

it would have to be adapted.

 

to start, you'll want to use nearly transparent buttons to overlay each name.  then you'll want to create a one frame movieclip for each vet that will include their picture and bio.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 04, 2023 Feb 04, 2023

Copy link to clipboard

Copied

What ended up doing is avoiding programming altogether. I have a series of buttons, one for each poster. The user has to click and hold to see the poster but so far nobody complained. I'm not a programmer so I couldn't figure out how to get the scripts suggested to be modified to work. I appreciate the time everyone took to answer the question and it was helpful to conceptually think about the answer. I learned a lot and will take more time to do a project like this in the future. Thanks!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 04, 2023 Feb 04, 2023

Copy link to clipboard

Copied

LATEST

you're welcome.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines