Jump to content
Search Community

Asking for help figuring out how to achieve this

Reemak test
Moderator Tag

Recommended Posts

Hi everybody, I'm new to timelinelite, someone recommend it to me to help me solve the problem i had, and it did, thanks for that incredible tool ! But now I'm having some other issues.

 

Let me try to describe what I want, and hopefully someone will generously help me...

 

The main stage has several different movieclips, each one containing a few buildings (it's a city landscape divided in different grounds).

Some of the buildings are actually made of three different buildings, and the idea is to make them switch one from the other, randomly. So let's say I have two mc, (background and foreground), each one composed of 5 or 6 mc (building1, buiding2, etc..).

 

A function called every 10 seconds with a timer, randomly picks a building, like building2, and plays it.

Building2 has 3 children on its timeline, Fading one out and the next one in at the same time, then stops.

That way, next time the random function picks it, it's gonna play from where it is to the next stop, fading the visible sub building out and revealing the next one.

 

I'm trying to reproduce that using timelinelites, as i think it's gonna improve it a lot, AND might solve the issue I have which appeared when the b****** client asked for the sub buildings to have mouseEventListeners...

 

The way I designed it at first makes it hard to add mouseover effects and I have a feeling i should :

 

- create a timelinelite for each randomized building

- adding labels to be able to target every 'state' of the building so that i could play them randomly

- adding listeners to the building only when it's visible on the stage

- removing them when it's not visible anymore

- ...

 

First things firts, I started trying to create a timelinelite that would just make my sub building appears one after the other, and i'm stuck already..

 

Any idea how to structure that ?

Link to comment
Share on other sites

Hi,

 

I am having trouble understanding exactly what you need help with and I'm not so sure that using TimelineLite/Max is going to drastically change how you add interactivity to the buildings.

 

First things firts, I started trying to create a timelinelite that would just make my sub building appears one after the other, and i'm stuck already..

 

this can be accomplished a number of ways. the following uses a TweenMax.allFromTo() inside and TimelineLite.insertMultiple();

 

import com.greensock.*;
import com.greensock.easing.*;

var buildings:Array = [building1, building2, building3];
var tl:TimelineLite = new TimelineLite();
tl.insertMultiple( TweenMax.allFromTo( buildings, 1, {alpha:0}, {alpha:1, immediateRender:true}), 0, "sequence");

 

that is a fairly advanced and compressed approach, perhaps the following is more clear:

 

import com.greensock.*;
import com.greensock.easing.*;


building1.alpha = building2.alpha = building3.alpha = 0;

var tl:TimelineLite = new TimelineLite();

tl.append( TweenLite.to(building1, 1, {alpha:1}));
tl.append( TweenLite.to(building2, 1, {alpha:1}));
tl.append( TweenLite.to(building3, 1, {alpha:1}));

 

 

if you really want to dive into the features of TimelineLite/Max check out:

http://active.tutsplus.com/?s=timelinelite

Link to comment
Share on other sites

Thank you very much for your help. It's muuuch appriciated.

 

I sure need to jump deep in and practice a lot, and i will do so,

The thing is i need to fade in a building while I fade out another one,

and to trigger the listeners when a fadein tween has completed...

 

the reason i want to do that is the way i coded it until now (through Flash IDE) creates issues with the listeners as targets aren't always on the stage (i guess that's the problem)

 

And to make it a bit easier, I thought I could label all that in order to call the tweens randomly...

 

In fact i was having trouble and when i discovered TimeLineLite I thought THAT was the best way to proceed, but i might be completely wrong...

 

Thank you for the help !

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...