0
Community Beginner
,
/t5/animate-discussions/cannot-embed-multiple-swfs-using-swfobject-2/td-p/142948
Jan 10, 2009
Jan 10, 2009
Copy link to clipboard
Copied
The site referenced can be found @
http://www.l4dt.com/
I need to embed multiple .swf files into an html file. I perfer using swfObject. Here's what the code looks like now:
<!-- l4dt_header.swf start -->
<script type="text/javascript">
var flashvars = {};
var params = {};
params.menu = "false";
params.quality = "best";
params.scale = "noscale";
params.wmode = "transparent";
var attributes = {};
attributes.id = "FL1";
attributes.name = "l4dt_header";
attributes.styleclass = "l4dt_header";
attributes.align = "middle";
swfobject.embedSWF("l4dt_header.swf", "FL", "605", "196", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
</script>
<!-- l4dt_header.swf end -->
<!-- l4dt_boomer.swf start -->
<script type="text/javascript">
var flashvars = {};
var params = {};
params.menu = "false";
params.quality = "medium";
params.scale = "noscale";
params.wmode = "transparent";
var attributes = {};
attributes.id = "FL";
attributes.name = "l4dt_boomer";
attributes.styleclass = "l4dt_boomer";
attributes.align = "right";
swfobject.embedSWF("boomer.swf", "FL", "100%", "100%", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
</script>
<!-- l4dt_boomer.swf start -->
What happens is one of the embededd swfs ends up overriding the other.
I also need the rotating movie clip to pulse, on and off, and bright lime green. I'm aware of the glow filter in actionscript 3, filters = [new GlowFilter(0x5d7c00,1,6,6,2,3)];, but how would I get it to pulse?
Then if you go to the site ( http://www.l4dt.com/ as stated above) you'll see a green cloud as that is part of the swf. I want to create the same toxic warning symbol that is rotating in the center, but much smaller, and multiple instances of it, flashing in and out at random locations in the green cloud.
Then I'll be creating a Flash App where a user can can layered "posters". Is this code sufficiant for allowing the user to be able to move those individual layers in perspective to the whole App?:
MC.addEventListener(MouseEvent.MOUSE_DOWN, function(evt:MouseEvent):void{
MC.startDrag();
}
);
MC.addEventListener(MouseEvent.MOUSE_UP, function(evt:MouseEvent):void{
MC.stopDrag();
}
);
I'm not asking for the definite answer to any of my problems, just 2 cents.
Ohh and if you have the time, tell me what you think of the site in general.
http://www.l4dt.com/
I need to embed multiple .swf files into an html file. I perfer using swfObject. Here's what the code looks like now:
<!-- l4dt_header.swf start -->
<script type="text/javascript">
var flashvars = {};
var params = {};
params.menu = "false";
params.quality = "best";
params.scale = "noscale";
params.wmode = "transparent";
var attributes = {};
attributes.id = "FL1";
attributes.name = "l4dt_header";
attributes.styleclass = "l4dt_header";
attributes.align = "middle";
swfobject.embedSWF("l4dt_header.swf", "FL", "605", "196", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
</script>
<!-- l4dt_header.swf end -->
<!-- l4dt_boomer.swf start -->
<script type="text/javascript">
var flashvars = {};
var params = {};
params.menu = "false";
params.quality = "medium";
params.scale = "noscale";
params.wmode = "transparent";
var attributes = {};
attributes.id = "FL";
attributes.name = "l4dt_boomer";
attributes.styleclass = "l4dt_boomer";
attributes.align = "right";
swfobject.embedSWF("boomer.swf", "FL", "100%", "100%", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
</script>
<!-- l4dt_boomer.swf start -->
What happens is one of the embededd swfs ends up overriding the other.
I also need the rotating movie clip to pulse, on and off, and bright lime green. I'm aware of the glow filter in actionscript 3, filters = [new GlowFilter(0x5d7c00,1,6,6,2,3)];, but how would I get it to pulse?
Then if you go to the site ( http://www.l4dt.com/ as stated above) you'll see a green cloud as that is part of the swf. I want to create the same toxic warning symbol that is rotating in the center, but much smaller, and multiple instances of it, flashing in and out at random locations in the green cloud.
Then I'll be creating a Flash App where a user can can layered "posters". Is this code sufficiant for allowing the user to be able to move those individual layers in perspective to the whole App?:
MC.addEventListener(MouseEvent.MOUSE_DOWN, function(evt:MouseEvent):void{
MC.startDrag();
}
);
MC.addEventListener(MouseEvent.MOUSE_UP, function(evt:MouseEvent):void{
MC.stopDrag();
}
);
I'm not asking for the definite answer to any of my problems, just 2 cents.
Ohh and if you have the time, tell me what you think of the site in general.
http://www.l4dt.com/
TOPICS
ActionScript
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 Correct answer
LEGEND
,
Jan 10, 2009
Jan 10, 2009
You use the same id "FL" in swfobject.embedSWF methods - so
one script overrides another into DOM element with id "FL".
And I would suggest you split your post into more focused topics.
And I would suggest you split your post into more focused topics.
LEGEND
,
/t5/animate-discussions/cannot-embed-multiple-swfs-using-swfobject-2/m-p/142949#M4445
Jan 10, 2009
Jan 10, 2009
Copy link to clipboard
Copied
You use the same id "FL" in swfobject.embedSWF methods - so
one script overrides another into DOM element with id "FL".
And I would suggest you split your post into more focused topics.
And I would suggest you split your post into more focused topics.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
mikeumus
AUTHOR
Community Beginner
,
/t5/animate-discussions/cannot-embed-multiple-swfs-using-swfobject-2/m-p/142950#M4446
Jan 10, 2009
Jan 10, 2009
Copy link to clipboard
Copied
If you look closer, you'll find that the first one is FL1,
the second FL, both with their own div's in the html:
<div align="center" id="FL1"><a href=" http://www.adobe.com/go/getflashplayer"><img src=" http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></div>
<div align="center" id="FL"><a href=" http://www.adobe.com/go/getflashplayer"><img src=" http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></div>
<div align="center" id="FL1"><a href=" http://www.adobe.com/go/getflashplayer"><img src=" http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></div>
<div align="center" id="FL"><a href=" http://www.adobe.com/go/getflashplayer"><img src=" http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></div>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/animate-discussions/cannot-embed-multiple-swfs-using-swfobject-2/m-p/142951#M4447
Jan 10, 2009
Jan 10, 2009
Copy link to clipboard
Copied
Yes, but in the method you target "FL" only in both cases:
swfobject.embedSWF("l4dt_header.swf", " FL", "605", "196", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
swfobject.embedSWF("boomer.swf", " FL", "100%", "100%", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
swfobject.embedSWF("l4dt_header.swf", " FL", "605", "196", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
swfobject.embedSWF("boomer.swf", " FL", "100%", "100%", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
mikeumus
AUTHOR
Community Beginner
,
/t5/animate-discussions/cannot-embed-multiple-swfs-using-swfobject-2/m-p/142952#M4448
Jan 10, 2009
Jan 10, 2009
Copy link to clipboard
Copied
The Sweetness!!!
Thanks mate, and pardon me calling you out saying you missed it when i did.
There are two dire problems now:
1
The boomer's bile (the green sprites coming out of his mouth) become slow and choopy sortly after they start and make the rotating toxic symbol slow as well. I am quite confident that any porfessional actionscript programmer could coupe with this and make them run perfectly, and I am determined.
Why can't it handle the sprites? Is that's whats making it so slow and choppy?
2
I'm aligning the boomer.swf with the css code:
.l4dt_boomer{
margin-left:0;
margin-top:0;
margin-right:0;
margin-bottom:0;
position:absolute;
top:0%;
right:0%;
z-index:-1
}
But if you go to the site, he's obviously not against the right corner. There is a ugly gap instead. This right: 0% is the same exact code I used to position the side bar at the site, so what gives?
Thanks mate, and pardon me calling you out saying you missed it when i did.
There are two dire problems now:
1
The boomer's bile (the green sprites coming out of his mouth) become slow and choopy sortly after they start and make the rotating toxic symbol slow as well. I am quite confident that any porfessional actionscript programmer could coupe with this and make them run perfectly, and I am determined.
Why can't it handle the sprites? Is that's whats making it so slow and choppy?
2
I'm aligning the boomer.swf with the css code:
.l4dt_boomer{
margin-left:0;
margin-top:0;
margin-right:0;
margin-bottom:0;
position:absolute;
top:0%;
right:0%;
z-index:-1
}
But if you go to the site, he's obviously not against the right corner. There is a ugly gap instead. This right: 0% is the same exact code I used to position the side bar at the site, so what gives?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/animate-discussions/cannot-embed-multiple-swfs-using-swfobject-2/m-p/142953#M4449
Jan 11, 2009
Jan 11, 2009
Copy link to clipboard
Copied
Do you mean this rotation thing in the header?
As for the DOM/css dilemma - I am sure it can be solved.
I don't observe any choppiness in the rotation thing. Where is the "the green sprites coming out of his mouth"? You need to post the code that is responsible for the problems you describe - it is impossible to guess without code.
As for the DOM/css dilemma - I am sure it can be solved.
I don't observe any choppiness in the rotation thing. Where is the "the green sprites coming out of his mouth"? You need to post the code that is responsible for the problems you describe - it is impossible to guess without code.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
mikeumus
AUTHOR
Community Beginner
,
/t5/animate-discussions/cannot-embed-multiple-swfs-using-swfobject-2/m-p/142954#M4450
Jan 11, 2009
Jan 11, 2009
Copy link to clipboard
Copied
Yea I took it off, because it surely wasn't helping the
reputation of the site, but i'll leave it on today I guess.
The sprites start fine, then as more occupy the screen at one shared time, everything gets slow, but there aren't even that many sprites!! lol. You'll see.
Is a possible solution to export this animation to After Effects and render it multiple times in the name of compression?
I figured this is how Adobe gets their big show off animations to run so smoothly, regardless there is surly a way.
The sprites start fine, then as more occupy the screen at one shared time, everything gets slow, but there aren't even that many sprites!! lol. You'll see.
Is a possible solution to export this animation to After Effects and render it multiple times in the name of compression?
I figured this is how Adobe gets their big show off animations to run so smoothly, regardless there is surly a way.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
mikeumus
AUTHOR
Community Beginner
,
/t5/animate-discussions/cannot-embed-multiple-swfs-using-swfobject-2/m-p/142955#M4451
Jan 11, 2009
Jan 11, 2009
Copy link to clipboard
Copied
It looks like it's budding against the Log in link
possibly?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/animate-discussions/cannot-embed-multiple-swfs-using-swfobject-2/m-p/142956#M4452
Jan 11, 2009
Jan 11, 2009
Copy link to clipboard
Copied
Now I see.
Conceptually it should work perfectly if done correctly- there are not that many objects and animation is not so complex that it stalls.
You really need to post code or describe in details how you do this animation.
Conceptually it should work perfectly if done correctly- there are not that many objects and animation is not so complex that it stalls.
You really need to post code or describe in details how you do this animation.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
mikeumus
AUTHOR
Community Beginner
,
LATEST
/t5/animate-discussions/cannot-embed-multiple-swfs-using-swfobject-2/m-p/142957#M4453
Jan 11, 2009
Jan 11, 2009
Copy link to clipboard
Copied
The boomer is constructed from three files:
Boomer.fla - http://www.l4dt.com/boomer.fla
Bommer.fla's document class, PxlFountain.as(courtesy of http://www.pxl.dk/flash/004.php) - http://www.l4dt.com/PxlFountain.as
GlowParticle.as - http://www.l4dt.com/GlowParticle.as
Boomer.fla bares no actionscript, although I need to know how to position him above the spawning sprites(something I'll need to know for the Poster App as well).
________________________________________________________________________________
PxlFountain.as:
package {
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.utils.Timer;
import flash.events.TimerEvent;
import GlowParticle;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import boomer;
public class PxlFountain extends Sprite {
//Properties
private var _fountainTimer:Timer;
private var _timerInterval:Number;
private var _particleVelocity:Number;
//Constructor
public function PxlFountain(timerInt:Number = 150, particleVel:Number = -2) {
//Set stage
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
//Set properties
_timerInterval = timerInt;
_particleVelocity = particleVel;
//Create timer
_fountainTimer = new Timer(_timerInterval, 80);
_fountainTimer.addEventListener(TimerEvent.TIMER, spawnParticle);
_fountainTimer.start();
}
//Create a new glow particle with random velocity
private function spawnParticle(event:TimerEvent):void {
var randomParticleVelocity:Number = (_particleVelocity * Math.random()) -2;
var particle:GlowParticle = new GlowParticle(randomParticleVelocity);
addChild(particle);
}
}
}
__________________________________________________________
GlowParticle.as:
package
{
import flash.display.Sprite;
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.display.Shape;
import flash.filters.GlowFilter;
public class GlowParticle extends Sprite {
//Properties
private var _particle:Shape;
private var _particleTimer:Timer;
private var _particleVelocity:Number;
private var _particleLifespan:Number;
private var _xPos:Number;
private var _yPos:Number;
private var _radius:Number;
private var _gravity:Number;
private var _vx:Number;
private var _vy:Number;
//Constructor
public function GlowParticle(particleVel:Number) {
//Set properties
_particle = new Shape();
_particleVelocity = particleVel;
_particleLifespan = 0;
_radius = 10 * Math.random();
_gravity = .7;
_xPos = 860;
_yPos = 60;
_vx = (Math.random() * 2 -2.4)*9;
_vy = particleVel;
//Set timer for movement and lifespan count
_particleTimer = new Timer(30);
_particleTimer.addEventListener(TimerEvent.TIMER, moveParticle);
_particleTimer.start();
}
//Calculate vectors, set new position and call draw method. Or respawn particle.
private function moveParticle(event:TimerEvent):void {
if(_particleLifespan < 300) {
_vy += _gravity;
_yPos += _vy;
_xPos += _vx;
_particleLifespan++;
drawParticle();
}
else{
respawnParticle();
}
}
//Draw the particle and set filter
private function drawParticle():void {
_particle.graphics.clear();
_particle.graphics.lineStyle(4, 0x455b00, 1);
_particle.graphics.drawCircle(_xPos,_yPos,_radius);
_particle.filters = [new GlowFilter(0x5d7c00,1,6,6,2,3)];
addChild(_particle);
}
//Respawn the particle
private function respawnParticle():void {
_particleLifespan = 0;
_xPos = 860;
_yPos = 60;
_vx = (Math.random() * 2 -2.4)*9;
_vy = _particleVelocity;
}
}
}
___________________________________________________________
The swf is being inserted into Worpress 2.7 footer.php. My Wordpress engine has 14 plugins installed and activated( I plan to go in to each plugin's code along with Wordpress' and optimize it soon). Is Wordpress a possible suspect for the slowness?
Boomer.fla's dimensions are 950 pixels in width and 625 pixels in height. I'd rather Boomer.fla only be 605x196 and set noscale and 100%x100% in hopes of the sprites reaching the user's whole screen, but they always cut off at the FLAs dimensions.
Boomer.fla - http://www.l4dt.com/boomer.fla
Bommer.fla's document class, PxlFountain.as(courtesy of http://www.pxl.dk/flash/004.php) - http://www.l4dt.com/PxlFountain.as
GlowParticle.as - http://www.l4dt.com/GlowParticle.as
Boomer.fla bares no actionscript, although I need to know how to position him above the spawning sprites(something I'll need to know for the Poster App as well).
________________________________________________________________________________
PxlFountain.as:
package {
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.utils.Timer;
import flash.events.TimerEvent;
import GlowParticle;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import boomer;
public class PxlFountain extends Sprite {
//Properties
private var _fountainTimer:Timer;
private var _timerInterval:Number;
private var _particleVelocity:Number;
//Constructor
public function PxlFountain(timerInt:Number = 150, particleVel:Number = -2) {
//Set stage
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
//Set properties
_timerInterval = timerInt;
_particleVelocity = particleVel;
//Create timer
_fountainTimer = new Timer(_timerInterval, 80);
_fountainTimer.addEventListener(TimerEvent.TIMER, spawnParticle);
_fountainTimer.start();
}
//Create a new glow particle with random velocity
private function spawnParticle(event:TimerEvent):void {
var randomParticleVelocity:Number = (_particleVelocity * Math.random()) -2;
var particle:GlowParticle = new GlowParticle(randomParticleVelocity);
addChild(particle);
}
}
}
__________________________________________________________
GlowParticle.as:
package
{
import flash.display.Sprite;
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.display.Shape;
import flash.filters.GlowFilter;
public class GlowParticle extends Sprite {
//Properties
private var _particle:Shape;
private var _particleTimer:Timer;
private var _particleVelocity:Number;
private var _particleLifespan:Number;
private var _xPos:Number;
private var _yPos:Number;
private var _radius:Number;
private var _gravity:Number;
private var _vx:Number;
private var _vy:Number;
//Constructor
public function GlowParticle(particleVel:Number) {
//Set properties
_particle = new Shape();
_particleVelocity = particleVel;
_particleLifespan = 0;
_radius = 10 * Math.random();
_gravity = .7;
_xPos = 860;
_yPos = 60;
_vx = (Math.random() * 2 -2.4)*9;
_vy = particleVel;
//Set timer for movement and lifespan count
_particleTimer = new Timer(30);
_particleTimer.addEventListener(TimerEvent.TIMER, moveParticle);
_particleTimer.start();
}
//Calculate vectors, set new position and call draw method. Or respawn particle.
private function moveParticle(event:TimerEvent):void {
if(_particleLifespan < 300) {
_vy += _gravity;
_yPos += _vy;
_xPos += _vx;
_particleLifespan++;
drawParticle();
}
else{
respawnParticle();
}
}
//Draw the particle and set filter
private function drawParticle():void {
_particle.graphics.clear();
_particle.graphics.lineStyle(4, 0x455b00, 1);
_particle.graphics.drawCircle(_xPos,_yPos,_radius);
_particle.filters = [new GlowFilter(0x5d7c00,1,6,6,2,3)];
addChild(_particle);
}
//Respawn the particle
private function respawnParticle():void {
_particleLifespan = 0;
_xPos = 860;
_yPos = 60;
_vx = (Math.random() * 2 -2.4)*9;
_vy = _particleVelocity;
}
}
}
___________________________________________________________
The swf is being inserted into Worpress 2.7 footer.php. My Wordpress engine has 14 plugins installed and activated( I plan to go in to each plugin's code along with Wordpress' and optimize it soon). Is Wordpress a possible suspect for the slowness?
Boomer.fla's dimensions are 950 pixels in width and 625 pixels in height. I'd rather Boomer.fla only be 605x196 and set noscale and 100%x100% in hopes of the sprites reaching the user's whole screen, but they always cut off at the FLAs dimensions.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

