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

help with selections

New Here ,
Oct 05, 2021 Oct 05, 2021

Copy link to clipboard

Copied

Hello I am new to the program and I really do not know much code, I hope you can help me.

I want to make an interactive animation at the beginning there is a selection of characters and backgrounds I want the user to select a character and a background and go to the next scene where only the character that he selected and the animated background are, I understand that this is with code how can I do it?

TOPICS
ActionScript , Ad development , Code

Views

78

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 ,
Oct 06, 2021 Oct 06, 2021

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
New Here ,
Oct 06, 2021 Oct 06, 2021

Copy link to clipboard

Copied

with 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 Expert ,
Oct 06, 2021 Oct 06, 2021

Copy link to clipboard

Copied

LATEST

use:

 

var selectedCharacter;

var selectedBackground;

var charactersA:Array = [your character instances here];

var backgroundsA:Array = [your background instances here];

 

// your next movieclip or button listener

yournextobject.addEventListener(MouseEvent.CLICK,nextF);

 

for(var i:int=0;i<charactersA.length;i++){

charactersA[i].addEventListener(MouseEvent.CLICK,characterF);

}

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

backgourndsA[i].addEventListener(MouseEvent.CLICK,backgroundF);

}

function characterF(e:MouseEvent):void{

selectedCharacter = e.currentTarget;

}

function backgroundF(e:MouseEvent):void{

selectedBackground = e.currentTarget;

}

function nextF(e:MouseEvent):void{

if(selectedCharacter && selectedBackground){

for(var i:int=0;i<charactersA.length;i++){

charactersA[i].parent.removeChild(charactersA[i]);

}

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

backgroundsA[i].parent.removeChild(backgroundsA[i]);

}

addChild(selectedBackground);

addChild(selectedCharacter);

// position each per your needs

} else {

// perhaps an info message to select one of each

}

}

 

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