RE: [flexcoders] .swf displays fine, but MovieClip methods fail

2008-08-13 Thread Alex Harui
When you embed a SWF, it gets wrapped in a MovieClipLoaderAsset and is
not the MovieClip itself.

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Merrill, Jason
Sent: Wednesday, August 13, 2008 10:23 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] .swf displays fine, but MovieClip methods fail

 

I'm displaying some sprites inside a Flex 3 container with Actionscript.
So far on this project, the sprites I have been showing have been
visually drawn on the screen either by embedding an image or by drawing
with sprite.graphics methods. Now, I'm trying to embed a .swf, and it
works (it displays and plays), but MovieClip method actions attempting
to control the embedded .swf fail.  

My first thought was I published as AM1 on accident, but the .swf is
AVM2 - Flash CS3 published as Player 9 and Actionscript 3.  The .swf
contains an animation on it's root, no child clips.  See the comments in
the code below (this is a simplified version of the class, I stripped
out everything I thought was irrelevant to my question).  Does it have
to do with a MovieClip being a child to a Sprite?  If so, why?  If not,
what's the issue with the code below?  

package com.venice.view.network.atom 
{ 
import flash.display.MovieClip; 
import flash.display.Sprite; 

public class AtomView extends Sprite 
{   
private var _menu:MovieClip; 

[Embed(source = "/media/buttons/atomMenu.swf")] 
[Bindable] 
private var _menuSource:Class; 

public function AtomView() 
{ 
createSprites(); 
} 

private function createSprites():void 
{ 
//this works fine, the menu.swf appears: 
_menu = new _menuSource() as MovieClip; 
addChild(_menu); 

//however, the following MovieClip actions don't
work.  
//For example, (when uncommented), the following
actions 
//have no effect on the root timeline: 
// 
//_menu.stop(); 
// 
//or if I put a stop action on the
.swf timeline, these don't work either: 
//_menu.nextFrame(); 
//or 
//_menu.play(); 
// 
//why? It's a Flash 9/Actionscript 3.0 .swf
created with Flash CS3. 
} 
} 
} 

Thanks for any help. 

 

Jason Merrill
Bank of America 
Enterprise Technology & Global Risk L&LD
Instructional Technology & Media 

Join the Bank of America Flash Platform Developer Community
http://sharepoint.bankofamerica.com/sites/tlc/flash/default.as
px>  

Are you a Bank of America associate interested in innovative learning
ideas and technologies?
Check out our internal  GT&O Innovative Learning Blog
http://sharepoint.bankofamerica.com/sites/ddc/rd/blog/default.
aspx>  & subscribe
http://sharepoint.bankofamerica.com/sites/ddc/rd/blog/_layouts
/SubNew.aspx?List=\%7b41BD3FC9-BB07-4763-B3AB-A6C7C99C5B8D\%7d&Source=ht
tp://sharepoint.bankofamerica.com/sites/ddc/rd/blog/Lists/Posts/Archive.
aspx> . 

 

 



[flexcoders] .swf displays fine, but MovieClip methods fail

2008-08-13 Thread Merrill, Jason
I'm displaying some sprites inside a Flex 3 container with Actionscript.  So 
far on this project, the sprites I have been showing have been visually drawn 
on the screen either by embedding an image or by drawing with sprite.graphics 
methods. Now, I'm trying to embed a .swf, and it works (it displays and plays), 
but MovieClip method actions attempting to control the embedded .swf fail.  

My first thought was I published as AM1 on accident, but the .swf is AVM2 - 
Flash CS3 published as Player 9 and Actionscript 3.  The .swf contains an 
animation on it's root, no child clips.  See the comments in the code below 
(this is a simplified version of the class, I stripped out everything I thought 
was irrelevant to my question).  Does it have to do with a MovieClip being a 
child to a Sprite?  If so, why?  If not, what's the issue with the code below?  

package com.venice.view.network.atom
{
import flash.display.MovieClip;
import flash.display.Sprite;

public class AtomView extends Sprite
{   
private var _menu:MovieClip;

[Embed(source = "/media/buttons/atomMenu.swf")]
[Bindable]
private var _menuSource:Class;

public function AtomView()
{
createSprites();
}

private function createSprites():void
{
//this works fine, the menu.swf appears:
_menu = new _menuSource() as MovieClip;
addChild(_menu);

//however, the following MovieClip actions don't work.  
//For example, (when uncommented), the following 
actions 
//have no effect on the root timeline:
//
//_menu.stop();
//
//or if I put a stop action on the .swf 
timeline, these don't work either:
//_menu.nextFrame();
//or
//_menu.play();
//
//why? It's a Flash 9/Actionscript 3.0 .swf created 
with Flash CS3.
}
}
}

Thanks for any help.


Jason Merrill 
Bank of America 
Enterprise Technology & Global Risk L&LD 
Instructional Technology & Media

Join the Bank of America Flash Platform Developer Community  
http://sharepoint.bankofamerica.com/sites/tlc/flash/default.aspx> 

Are you a Bank of America associate interested in innovative learning ideas and 
technologies?
Check out our internal  GT&O Innovative Learning Blog 
http://sharepoint.bankofamerica.com/sites/ddc/rd/blog/default.aspx>  
& subscribe 
http://sharepoint.bankofamerica.com/sites/ddc/rd/blog/_layouts/SubNew.aspx?List=\{41BD3FC9-BB07-4763-B3AB-A6C7C99C5B8D\}&Source=http://sharepoint.bankofamerica.com/sites/ddc/rd/blog/Lists/Posts/Archive.aspx>
 .