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

How to Add Sprite Object With Animation?

New Here ,
Mar 18, 2012 Mar 18, 2012

Copy link to clipboard

Copied

What I'm about to ask might be completely nonsense/basic or something else. Because my AS knowledge is too little. Hope I can explain correctly.

I am tring to create a sliding banner animation dynamically. The reason that I create dynamic is that I want to load banner images and headlines from XML file.

So I found a sample project with .as and .xml file. It does what I want but it has no animation. You can see the demo here:
http://active.tutsplus.com/tutorials/actionscript/create-an-image-rotator-in-flash-using-xml-and-act...

As you can see, there's a transparent info panel below. Here's the code how it is being created:

private var infoPanel:Sprite = new Sprite();
private var titleField:TextField = new TextField();
private var description:TextField = new TextField();

private function createInfoPanel():void
{
infoPanel
.graphics.beginFill(0x000000, 0.5);
infoPanel
.graphics.drawRect(0, 0, 967, 138);
infoPanel
.graphics.endFill();

titleField
.text = xml.children()[infoCounter]. @ title;
titleField
.x = 50;
titleField
.y = 25;

description
.text = xml.children()[infoCounter]. @ description;
description
.x = 52;
description
.y = 51;

infoPanel
.y = 300;

infoPanel
.addChild(titleField);
infoPanel
.addChild(description);

addChild
(infoPanel);
}

When I create it like this, there is no animation, it is static and only text is changing. 

Here's what I want to do:
When it is being created,


come to screen from below,
sliding to top,
then text appear,
before the image changes, text disappear
than the panel slides down then image changes.

How can I implement this? Thanks.

P.S. You can see the whole code in the link.

TOPICS
ActionScript

Views

902

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 ,
Mar 18, 2012 Mar 18, 2012

Copy link to clipboard

Copied

start your infoPanel below the screen (assign its y property to be stage.stageHeight) and use the tween class to tween it on-stage.  there's no code shown that would change the text of the same infoPanel instance so you'll need to change that class significantly or create a controller class that controls the tweening on and then offstage, create a new instance and tween on and then on stage etc.

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 ,
Mar 18, 2012 Mar 18, 2012

Copy link to clipboard

Copied

hi,

instead of actionscript, I created a panel myself as a new layer. but now I have two problems:

1- before I had one layer with actionscript. now I have 2 layers and actionscript layer is covering my movieclip layer that contains panel background of the text.

so in .as file, I added this line:

line 117: this.setChildIndex(imagesVector, 0);

now it is behaving strange like this: it only shows 1 image until the animation completes 1st turn, then it begins to work correctly. I can't understand why

2- I have to delay my text according to my movie clip layer. now the text is always there, only panel is coming up and down...

please take a look at source files when you have time, considering that's all I can explaing here:

https://rapidshare.com/files/2794372874/Src.rar

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 ,
Mar 18, 2012 Mar 18, 2012

Copy link to clipboard

Copied

the layer that contains your actionscript has nothing to do with the depth of the objects created by that actionscript.

perhaps someone else will download and fix your files for you but i don't do that unless hired.  for free help, approach your project logically and if you run into a problem, pinpoint it and post it here.

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 ,
Mar 19, 2012 Mar 19, 2012

Copy link to clipboard

Copied

LATEST

I see, you are right.

I been working on this and I did mostly what I want. Now I have 2 issues. I posted them as a new question.

Here: http://forums.adobe.com/thread/976993

Hope someone can help this time.

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