Convert AS2 swf to AS3 swf
I have a swf (written in AS3) that loads other swfs into it.
There are no issues when loading other AS3 swfs but there is a
problem loading AS2 swfs. I get the following error:
TypeError: Error #1034: Type Coercion failed: cannot convert
flash.display::AVM1Movie@35d3a51 to flash.display.MovieClip.
Is there any way to convert the AS2 swf into a AS3 swf so it
will be compatible with my loader? I cannot go back and change the
AS2 swfs because I do not have the fla files. Or is there any way
to incorporate AS3 code that will load AS2 swfs properly? It seems
hard to believe that Adobe would neglect this backwards
compatibility issue. Thanks
Hello Andrei1,
Thanks for looking at my simple AS3 code. The AS2 swfs that
I've been working (and having difficulties) with are components
that I've purchased from places like www.flashden.com. Some are
image transitions (such as "Dynamic Image Draw found at
http://www.flashden.net/item/dynamic-image-draw/7532)
while another is used to create a looped banner rotator animation
(IMG_loop, a free d/l from www.afcomponents.net). I have another
that uses an .xml file to configure a slideshow animation.
You mention "needing to do more" if AS2 scripts inside its
swf are to be run by the parent AS3 fla; what would these lines of
code be?
In researching my problem further I've since realized that
most of these issues deal both with the version of AS used, as well
as the version of the Flash player the fla is set up to animate
for. In particular, the "Dynamic Image Draw" component requires
that Flash Player 8 or 9 be used with AS2.
Given that many of my purchased components are like this,
I've since changed my main fla movie from AS3 back to AS2 and have
learned that the scripting needed to call individual multiple swfs
into it at various points in the timeline is MUCH simpler!!!!! One
single, easily interpreted, line of code vs. 5 lines using
variables and much more arcane (to me) function calls.
I started my file with AS3 figuring that I'd be better off
learning the new version of the language; much stress and
forehead-rubbing later, I've seen just how much easier and
understandable AS2 is to learn.
I recognize that there are likely very strong arguments for
the more structured coding approach used by AS3, but for someone
like me who wants to generate customized Flash presentations with
little fuss, I'm not qualified to make them.
Perhaps this is a no brainer for those many flash gurus out
there, but for me this tiny bit of wisdom has been hard fought for!
That being said, is there an easy way to convert a swf file
created using AS2 to something that AS3 can work/interact with?
I've come across a free d/l product called actionscript bridge, but
haven't been able to understand how to get it to work.
Similar Messages
-
Load AS2 swf into AS3 swf problem
I have a flash with AS3 and inside this swf i load in a AS2 swf.
to load swf works just fine, but the problem is when i load this i want to go to
a specific part of it, for example i want to go to frame 3 in the loaded swf.
i must control this from the AS3 swf, does someone know if this is possible?
thanks in advanceso can i do like this then to go to frame 3 in my loaded swf?
MovieClip(ldr.content).gotoAndStop(3); ?
sorry for being such an airhead
thanks for helping me out =)
Date: Sun, 7 Jun 2009 10:25:09 -0600
From: [email protected]
To: [email protected]
Subject: load AS2 swf into AS3 swf problem
no.
if, in your loaded swf, you have a function f1() on the loaded swf's main timeline and you load that swf using a loader (say ldr), use:
MovieClip(ldr.content).f1(); // to call f1() in the loaded swf
> -
Load AS2 SWF in AS3 SWF with FlashVars
I am able to load SWF which is created using AS2 in to AS3
SWF but I am not able to pass Flashvars to it..
Does any one has any idea, how can I do that??
ThanksYou can talk to loaded AVM1 (AS1/2) SWF using LocalConnection. I used Grant Skinner's SWFBridge class in the past and worked very well:
http://gskinner.com/blog/archives/2007/07/swfbridge_easie.html
Kenneth Kawamoto
http://www.materiaprima.co.uk/ -
AS2 .swf to AS3.swf
This may have been posted somewhere else however I have created a series of AS2 .swfs and now that I am using captivate 5 i need to convert them to as3.swf
Can anyone helpThat's going to depend on whether or not there's any AS2 code in your SWFs and how complex that code is.
Did you create these SWFs in Flash? If so, what version? If it's Flash CS3 or above you should be able to open the original FLA files and change your publish settings to output as AS3.
If you've programmed a lot of interactivity into these SWFs as AS2 and you don't know AS3, you'll need to either learn it yourself or pay someone that does. -
Communication between AS2 Template and AS3 Swf
I created a template in AS2 which loads as2 swf's. i want to load as3 swf. then how can load as3 swf.within as2 template.
please help me to find out this...hI,
Look at package SDYNAMICDOCUMENTS, or look for DD_* ( This is Dynamic Documents Tamplates ) in SE38.
Regards,
Marcelo Ramos. -
Hi All,
I am new to this forum.
Can anyone tell me how to load as2 swf in as3?
If this is possible,can anyone give me some sample example?
Thanks
HarshalYou can talk to loaded AVM1 (AS1/2) SWF using LocalConnection. I used Grant Skinner's SWFBridge class in the past and worked very well:
http://gskinner.com/blog/archives/2007/07/swfbridge_easie.html
Kenneth Kawamoto
http://www.materiaprima.co.uk/ -
Dummy Guide needed for converting AS2 code into AS3
I have to convert my existing AS2 code into AS3, but I might as well be reading chinese. I never even began to learn AS3, it was still fairly new at the time and the class ended before we had an opportunity to even touch on it. My major was not web design, it was the print side of design. I took an additional class, after I graduated, to learn web design and our teacher told us, basically, that we were designers, not coders so we won't be getting much into actionscripting, beyond the basics. At the time I was relieved, but looking back, I really wish we would have gotten more into it. Bottom line, I need to learn now.
Is there ANYONE that can help me out? I will list my code below, buy I am way beyond lost any help that can be provided, I would be so grateful!!!!
On the main timeline I have the basic..
stop(); -- I found the AS3 version, but I don't know what I'm looking at. I get "not_yet_set.stop()" and there are are 8 options I can choose from. I just want the timeline to stop until I tell it where to go next. And what is "not_yet_set"
Then I have my buttons, which are, basically...
on (release) {
gotoAndStop("Home");
Or "gotoAndPlay("Whatever");"
I also have buttons for scrolling...
on (press) {
play();
on (release) {
stop();
AND
on (press) {
_root.AboutMe_Controller.gotoAndPlay(…
on (release) {
_root.AboutMe_Controller.gotoAndStop(…
For the on(release) command, this is what I found as the AS3 version: not_set_yet.dispatchEvent()because that's really as1 code, you have steeper learning curve than going from as2 to as3.
first, remove all code from objects, assign instance names to your buttons and you can then start on as3:
// so, if you name your home button, home_btn:
home_btn.addEventListener(MouseEvent.CLICK,homeF);
function homeF(e:MouseEvent):void{
gotoAndStop("Home");
p.s. the not_yet_set stuff is there because you tried to use script assist or some other actionscript shortcut. -
here is the code i'm using:
var url:String = "avm1.swf";
var urlrequest:URLRequest = new URLRequest(url);
var loader:Loader = new Loader();
loaderListener(loader.contentLoaderInfo);
loader.load(urlrequest);
function loaderListener(dispatched:IEventDispatcher){
dispatched.addEventListener(Event.COMPLETE, assignSWF);
function assignSWF(event:Event){
addChild(loader.content);
here is the error i get:
It is illegal to move AVM1 content (AS1 or AS2) to a
different part of the displayList when it has been loaded into AVM2
(AS3) content.
Is there a different way to do this?addChild(loader)
-
Trying to convert AS2 code to AS3
I had this code in AS2 and it worked I am trying to convert
it to AS3 however and am stuck Please Help!!
Thanks,
Alexjust add your click listeners and handlers:
-
Convert as2 code to as3 please help
function fDieList()
if (pDieList.length > 0)
_root.inSFX.die.start();
for (var _loc2 = 0; _loc2 <= pDieList.length; ++_loc2)
pDieList[_loc2].fDie();
} // end of for
pDieList = [];
actioner.pKills = true;
} // end if
} // End of the function
function fDieListSetup()
if (pDieList.length > 0)
for (var _loc1 = 0; _loc1 <= pDieList.length; ++_loc1)
pDieList[_loc1].fDieSetup();
} // end of for
} // end if
} // End of the function
function recur(fromx, fromy, tox, toy)
var _loc2 = fromy;
var _loc1 = fromx;
var _loc3 = toy;
if (_loc1 == tox && _loc2 == _loc3)
return (true);
else
++len;
drum[len][0] = _loc1;
drum[len][1] = _loc2;
wa[_loc1][_loc2] = 1;
if (_loc1 > tox && _loc2 > _loc3)
if (_loc1 > 1 && wa[_loc1 - 1][_loc2] == 0)
ok = recur(_loc1 - 1, _loc2, tox, _loc3);
if (ok)
return (ok);
} // end if
} // end if
if (_loc2 > 1 && wa[_loc1][_loc2 - 1] == 0)
ok = recur(_loc1, _loc2 - 1, tox, _loc3);
if (ok)
return (ok);
} // end if
} // end if
if (_loc1 < limits && wa[_loc1 + 1][_loc2] == 0)
ok = recur(_loc1 + 1, _loc2, tox, _loc3);
if (ok)
return (ok);
} // end if
} // end if
if (_loc2 < limits && wa[_loc1][_loc2 + 1] == 0)
ok = recur(_loc1, _loc2 + 1, tox, _loc3);
if (ok)
return (ok);
} // end if
} // end if
else if (_loc1 <= tox && _loc2 > _loc3)
if (_loc2 > 1 && wa[_loc1][_loc2 - 1] == 0)
ok = recur(_loc1, _loc2 - 1, tox, _loc3);
if (ok)
return (ok);
} // end if
} // end if
if (_loc1 < limits && wa[_loc1 + 1][_loc2] == 0)
ok = recur(_loc1 + 1, _loc2, tox, _loc3);
if (ok)
return (ok);
} // end if
} // end if
if (_loc2 < limits && wa[_loc1][_loc2 + 1] == 0)
ok = recur(_loc1, _loc2 + 1, tox, _loc3);
if (ok)
return (ok);
} // end if
} // end if
if (_loc1 > 1 && wa[_loc1 - 1][_loc2] == 0)
ok = recur(_loc1 - 1, _loc2, tox, _loc3);
if (ok)
return (ok);
} // end if
} // end if
else if (_loc1 > tox && _loc2 <= _loc3)
if (_loc1 > 1 && wa[_loc1 - 1][_loc2] == 0)
ok = recur(_loc1 - 1, _loc2, tox, _loc3);
if (ok)
return (ok);
} // end if
} // end if
if (_loc2 < limits && wa[_loc1][_loc2 + 1] == 0)
ok = recur(_loc1, _loc2 + 1, tox, _loc3);
if (ok)
return (ok);
} // end if
} // end if
if (_loc1 < limits && wa[_loc1 + 1][_loc2] == 0)
ok = recur(_loc1 + 1, _loc2, tox, _loc3);
if (ok)
return (ok);
} // end if
} // end if
if (_loc2 > 1 && wa[_loc1][_loc2 - 1] == 0)
ok = recur(_loc1, _loc2 - 1, tox, _loc3);
if (ok)
return (ok);
} // end if
} // end if
else
if (_loc2 < limits && wa[_loc1][_loc2 + 1] == 0)
ok = recur(_loc1, _loc2 + 1, tox, _loc3);
if (ok)
return (ok);
} // end if
} // end if
if (_loc1 < limits && wa[_loc1 + 1][_loc2] == 0)
ok = recur(_loc1 + 1, _loc2, tox, _loc3);
if (ok)
return (ok);
} // end if
} // end if
if (_loc2 > 1 && wa[_loc1][_loc2 - 1] == 0)
ok = recur(_loc1, _loc2 - 1, tox, _loc3);
if (ok)
return (ok);
} // end if
} // end if
if (_loc1 > 1 && wa[_loc1 - 1][_loc2] == 0)
ok = recur(_loc1 - 1, _loc2, tox, _loc3);
if (ok)
return (ok);
} // end else if
} // end else if
} // end else if
--len;
return (ok);
} // end else if
} // End of the function
function way(fromx, fromy, tox, toy)
len = 0;
ok = false;
for (i = 1; i <= limits; i++)
for (j = 1; j <= limits; j++)
wa[i][j] = ma[i][j];
} // end of for
} // end of for
wa[fromx][fromy] = 0;
return (recur(fromx, fromy, tox, toy));
} // End of the function
function init()
var _loc2 = _root;
scorerule = new Array(40, 50, 60, 70, 80);
score = 0;
totalballs = 7;
nextballs = 3;
limits = 9;
kkk = 1000;
xnext = next1._x - 19;
ynext = next1._y + 21;
ballsput = 0;
drum = new Array();
wa = new Array();
st = new Array();
for (i = 1; i <= limits * limits; i++)
drum[i] = new Array(0, 0);
} // end of for
for (i = 1; i <= limits * limits; i++)
wa[i] = new Array(limits + 1);
} // end of for
selected = new Array(0, 0);
ma = new Array();
for (i = 1; i <= limits; i++)
ma[i] = new Array(limits + 1);
for (j = 1; j <= limits; j++)
ma[i][j] = 0;
_loc2.inGame["balls" + i + j].x = i;
_loc2.inGame["balls" + i + j].y = j;
} // end of for
} // end of for
nextarray = new Array();
for (i = 1; i <= nextballs; i++)
nextarray[i] = new Array(0, 0, 0);
attachMovie("balls", "nextballs" + i, kkk++);
_loc2.inGame["nextballs" + i]._x = xnext;
_loc2.inGame["nextballs" + i]._y = ynext + i * 60;
_loc2.inGame["nextballs" + i]._xscale = 140;
_loc2.inGame["nextballs" + i]._yscale = 140;
} // end of for
actioner2.swapDepths(20000);
} // End of the function
function generatenext()
var _loc2 = _root;
if (ballsput <= 81 - nextballs)
togenerate = nextballs;
else
togenerate = 81 - ballsput;
} // end else if
for (i = 1; i <= togenerate; i++)
do
x = random(limits) + 1;
y = random(limits) + 1;
} while (ma[x][y] != 0)
nextarray[i][0] = random(totalballs) + 1;
nextarray[i][1] = x;
nextarray[i][2] = y;
_loc2.inGame["nextballs" + i].gotoAndStop(nextarray[i][0] + 1);
_loc2.inGame["nextballs" + i].buton._visible = false;
} // end of for
for (i = togenerate + 1; i <= nextballs; i++)
_loc2.inGame["nextballs" + i].gotoAndStop("blank");
} // end of for
nextballs3.buton._visible = false;
} // End of the function
function putnextballs()
var _loc2 = _root;
_loc2.inSFX.grow.start();
if (ballsput <= 81 - nextballs)
togenerate = nextballs;
else
togenerate = 81 - ballsput;
} // end else if
for (i = 1; i <= togenerate; i++)
if (ma[nextarray[i][1]][nextarray[i][2]] == 0)
ma[nextarray[i][1]][nextarray[i][2]] = nextarray[i][0];
else
do
x = random(limits) + 1;
y = random(limits) + 1;
} while (ma[x][y] != 0)
nextarray[i][1] = x;
nextarray[i][2] = y;
ma[nextarray[i][1]][nextarray[i][2]] = nextarray[i][0];
} // end else if
_loc2.inGame["balls" + nextarray[i][1] + nextarray[i][2]].gotoAndStop(nextarray[i][0] + 1);
line(nextarray[i][1], nextarray[i][2], ma[nextarray[i][1]][nextarray[i][2]]);
} // end of for
ballsput = ballsput + togenerate;
if (ballsput == limits * limits)
_loc2.fEndGame();
} // end if
} // End of the function
function line(x, y, c)
var _loc4 = 0;
var _loc6 = new Array();
var _loc5 = new Array();
var _loc2 = new Array();
var _loc3 = new Array();
for (var _loc4 = 1; _loc4 <= limits; ++_loc4)
_loc6[_loc4] = new Array(2);
_loc5[_loc4] = new Array(2);
_loc2[_loc4] = new Array(2);
_loc3[_loc4] = new Array(2);
} // end of for
var _loc7 = 0;
fl = 0;
for (var _loc4 = 1; _loc4 <= limits; ++_loc4)
if (ma[_loc4][y] == c)
if (fl == 0)
++_loc7;
_loc6[_loc7][0] = _loc4;
_loc6[_loc7][1] = y;
} // end if
continue;
} // end if
if (_loc7 < 4)
_loc7 = 0;
continue;
} // end if
fl = 1;
} // end of for
st1 = 0;
fl = 0;
for (var _loc4 = 1; _loc4 <= limits; ++_loc4)
if (ma[x][_loc4] == c)
if (fl == 0)
++st1;
_loc5[st1][0] = x;
_loc5[st1][1] = _loc4;
} // end if
continue;
} // end if
if (st1 < 4)
st1 = 0;
continue;
} // end if
fl = 1;
} // end of for
fl = 0;
st2 = 0;
imin = x;
for (jmin = y; imin > 1 && jmin > 1; jmin--)
--imin;
} // end of for
imax = x;
for (jmax = y; imax < limits && jmax < limits; jmax++)
++imax;
} // end of for
if (imin == 1)
for (var _loc4 = imin; _loc4 <= imax; ++_loc4)
if (ma[_loc4][jmin + _loc4 - 1] == c)
if (fl == 0)
++st2;
_loc2[st2][0] = _loc4;
_loc2[st2][1] = jmin + _loc4 - 1;
} // end if
continue;
} // end if
if (st2 < 4)
st2 = 0;
continue;
} // end if
fl = 1;
} // end of for
else
for (var _loc4 = jmin; _loc4 <= jmax; ++_loc4)
if (ma[imin + _loc4 - 1][_loc4] == c)
if (fl == 0)
++st2;
_loc2[st2][0] = imin + _loc4 - 1;
_loc2[st2][1] = _loc4;
} // end if
continue;
} // end if
if (st2 < 4)
st2 = 0;
continue;
} // end if
fl = 1;
} // end of for
} // end else if
fl = 0;
st3 = 0;
imin = x;
for (jmin = y; imin > 1 && jmin < limits; jmin++)
--imin;
} // end of for
imax = x;
for (jmax = y; imax < limits && jmax > 1; jmax--)
++imax;
} // end of for
if (imin == 1)
for (var _loc4 = imin; _loc4 <= imax; ++_loc4)
if (ma[_loc4][jmin - _loc4 + 1] == c)
if (fl == 0)
++st3;
_loc3[st3][0] = _loc4;
_loc3[st3][1] = jmin - _loc4 + 1;
} // end if
continue;
} // end if
if (st3 < 4)
st3 = 0;
continue;
} // end if
fl = 1;
} // end of for
else
for (var _loc4 = jmax; _loc4 <= jmin; ++_loc4)
if (ma[jmin - _loc4 + jmax][_loc4] == c)
if (fl == 0)
++st3;
_loc3[st3][0] = jmin - _loc4 + jmax;
_loc3[st3][1] = _loc4;
} // end if
continue;
} // end if
if (st3 < 4)
st3 = 0;
continue;
} // end if
fl = 1;
} // end of for
} // end else if
destroyed = 0;
if (_loc7 >= 4)
for (var _loc4 = 1; _loc4 <= _loc7; ++_loc4)
pDieList.push(_root.inGame["balls" + _loc6[_loc4][0] + _loc6[_loc4][1]]);
ma[_loc6[_loc4][0]][_loc6[_loc4][1]] = 0;
} // end of for
destroyed = destroyed + _loc7;
score = score + scorerule[_loc7 - 4];
} // end if
if (st1 >= 4)
for (var _loc4 = 1; _loc4 <= st1; ++_loc4)
pDieList.push(_root.inGame["balls" + _loc5[_loc4][0] + _loc5[_loc4][1]]);
ma[_loc5[_loc4][0]][_loc5[_loc4][1]] = 0;
} // end of for
destroyed = destroyed + st1;
score = score + scorerule[st1 - 4];
} // end if
if (st2 >= 4)
for (var _loc4 = 1; _loc4 <= st2; ++_loc4)
pDieList.push(_root.inGame["balls" + _loc2[_loc4][0] + _loc2[_loc4][1]]);
ma[_loc2[_loc4][0]][_loc2[_loc4][1]] = 0;
} // end of for
destroyed = destroyed + st2;
score = score + scorerule[st2 - 4];
} // end if
if (st3 >= 4)
for (var _loc4 = 1; _loc4 <= st3; ++_loc4)
pDieList.push(_root.inGame["balls" + _loc3[_loc4][0] + _loc3[_loc4][1]]);
ma[_loc3[_loc4][0]][_loc3[_loc4][1]] = 0;
} // end of for
destroyed = destroyed + st3;
score = score + scorerule[st3 - 4];
} // end if
if (destroyed >= 10)
--destroyed;
} // end if
ballsput = ballsput - destroyed;
scoretxt = score;
if (destroyed != 0)
fDieListSetup();
_root.inSFX.pickup.start();
} // end if
return (destroyed != 0);
} // End of the function
function fromactioner(fromx, fromy, tox, toy)
var _loc3 = toy;
var _loc2 = tox;
var _loc4 = fromy;
ma[_loc2][_loc3] = ma[fromx][_loc4];
ma[fromx][_loc4] = 0;
_root.inGame["balls" + fromx + _loc4].gotoAndStop("blank");
_root.inGame["balls" + fromx + _loc4].ball.gotoAndStop(1);
_root.inGame["balls" + _loc2 + _loc3].gotoAndStop(ma[_loc2][_loc3] + 1);
_root.inGame["balls" + _loc2 + _loc3].ball.gotoAndStop(1);
selected[0] = 0;
selected[1] = 0;
line(_loc2, _loc3, ma[_loc2][_loc3]);
actioner.gotoAndPlay(2);
} // End of the function
function move(fromx, fromy, tox, toy)
var _loc2 = _root;
var _loc3 = false;
if (way(fromx, fromy, tox, toy))
_loc3 = true;
fromactioner(fromx, fromy, tox, toy);
_loc2.inGame["balls" + _loc2.inGame.drum[ii][0] + _loc2.inGame.drum[ii][1]].gotoAndStop("blank");
} // end if
return (_loc3);
} // End of the function
function movetest(fromx, fromy, tox, toy)
var _loc1 = false;
if (way(fromx, fromy, tox, toy))
_loc1 = true;
} // end if
return (_loc1);
} // End of the function
pLastClicked = "none";
pLastClickedType = 1;
pClicked = false;
pDieList = [];
init();
generatenext();
putnextballs();
generatenext();
stop ();Zhanbolat,
In theory, conversion of this code is not difficult, especially because it is clear what the logic is designed to do. The issue is that you will not have an expected result once only this code is converted in isolation. This puppy uses some other objects that are written in AS2 including entities in the FLA library.
In short, it looks like this application needs a total overhaul at every level in order for it to properly function as an AS3 program.
With that said, although this is, again, not a difficult task, it is unlikely to find someone to do it for free. You may have a better luck if you start conversion yourself and post focused questions as you go. -
Please help me to convert this code..............
for (i = 1; i <= nextballs; i++)
nextarray[i] = new Array(0, 0, 0);
attachMovie("balls", "nextballs" + i, kkk++);
_loc2.inGame["nextballs" + i]._x = xnext;
_loc2.inGame["nextballs" + i]._y = ynext + i * 60;
_loc2.inGame["nextballs" + i]._xscale = 140;
_loc2.inGame["nextballs" + i]._yscale = 140;var nextballs:int = 4; // <- nextballs needs to be defined, though need not be defined this way.
for (var i:int = 1; i <= nextballs; i++)
var nextarray[i]:Array = new Array(0, 0, 0);
this["nextballs"+i]=new balls();
addChild(this["ballballs"+i]);
// xnext and ynext need to be defined and should probably be updated in this for-loop
// this part of your code makes no sense given your attachMovie() statement.
_loc2.inGame["nextballs" + i].x = xnext;
_loc2.inGame["nextballs" + i].y = ynext + i * 60;
_loc2.inGame["nextballs" + i].scaleX = 1.4;
_loc2.inGame["nextballs" + i].scaleY = 1.4; -
AS2 SWF loaded inside a AS3 SWF
Hi,
In a recent project I had to load a FlashPaper2 document
inside a SWF implemented in AS3. I read a couple of articles about
Darron
Shcall's article and
FlashInterface
but none of them seemed to be useful in my case.
I needed to load a FlashPaper SWF inside a AS3 and couldn't
rely on ExternalInterface since they were not two separate SWF's.
To be more clear, I was using the Loader class via a Sprite to load
the FlashPaper SWF.
Anyways, I created FlashPaperLoader.SWF implemented in AS2
which was used to load the FlashPaper SWF. This loader was able to
communicate with the FlashPaper APIs (AS2). As you can guess, the
AS3 SWF was used to load the FlashPaperLoader.swf.
What I don't understand is how come the FlashPaperLoader the
FlashPaper document SWFs can communicate with each other thru AS2
function calls when they are loaded inside a AS3 SWF, I thought
that due to VM differences, no communication is possible!
I hope I was clear, if I was, any guru insight is really
appreciated.
Cheers.Thanks kglad,
But you still haven't answered my question. I am not looking
for solutions, my own solution works. I wanted to understand more
about the VM's.
AS3
var request:URLRequest = new
URLRequest("./FlashPaperLoader.swf");
var loader:Loader = new Loader();
loader.load(request);
AS2
var loader:MovieClipLoader = new MovieClipLoader();
loader.loadClip("./FlashPaperDoc.swf", fpContainer);
// the loader SWF used IFlashPaper APIs to communicate with
the FlashPaper SWF.
Now, the first part (AS3), all that code is interpreted by
VM2. Once an AS2 SWF is loaded a
AVM1Movie
is created and no direct communication between AS3 and AS2 is
possible. I am curious to know how come the two AS2 SWFs can
communicate with each other while inside the VM2 space. -
Embed AS3 swf into a AS2 FLA?
HI, I have a flash site designed in AS2 and want to embed a
AS3 video player in it. If I republish the AS2 site to AS3 the
website doesnt function, and if I load the AS3 swf into the
website, the Player doesnt function.
I need the AS2 functionality on the website and I need the
advanced AS3 functionality on the video Player.
Is there any way to get these two guys to talk to each
other?Creating a 3rd fla, to load the AS2 Fla and the AS3 FLA just
aint gonna fly. This website is updated daily and its just too much
of a maintenance nightmare.
However, I do want to use Wabbits suggestion but I dont know
how to create a web object.
The GetURL function opens the swf on its own, which I dont
want to do. I want it to open the AS3 SWF in a small window within
the page.
Can someone help please? Thanks in advance, -
AS2 swf to AS3 local Connection
Hello:
I am embedding multiple copies of a single AS2 swf build in
FLASH into a FLEX2 AS3 swf. I am using LocalConnection to
communicate from FLEX to the flash swfs. This exhibits the strange
behaviour that only the last loaded swf actually works correctly.
The swf is a told to gotoAndStop at a particular frame. I trace the
FLASH swf function and it is getting the correct frame number from
FLEX. But it does not work correctly.
see a samle at
http://www.miragevideo.com/test.html
The problem seems to be the localConnectin being shared by
three similar instances of the gauge class. Any ideas??
Here is the FLEX code
<?xml version="1.0"
encoding="utf-8"?>
<mx:Canvas xmlns:mx="
http://www.adobe.com/2006/mxml"
width="400" height="200"
horizontalScrollPolicy="off"
verticalScrollPolicy="off">
<mx:Image id="gaugeSWF"
source="@Embed(source='../../resources/gauge.swf')"
creationComplete="init();" />
<mx:Script>
<![CDATA[
import flash.net.LocalConnection;
private var toFlash_lc:LocalConnection = new
LocalConnection();
private var _amount:int;
private function init():void{
toFlash_lc.addEventListener(StatusEvent.STATUS, onStatus);
toFlash_lc.send("lc_from_Flex",
'setGauge',_amount) ;
public function set amount(val:int):void{
_amount = val;
private function onStatus(event:StatusEvent):void {
switch (event.level) {
case "status":
// trace("LocalConnection.send()
succeeded");
break;
case "error":
trace("LocalConnection.send() failed");
break;
]]>
</mx:Script>
</mx:Canvas>
and the FLASH code:
// Code in the receiving SWF file
var receiving_lc:LocalConnection = new LocalConnection();
receiving_lc.setGauge = function(frame:Number) {
trace("in flash frame= " + frame +
" angle: " + ((frame/100)*180));
mask._rotation = -(frame/100)*180;
angle.text = frame.toString();
receiving_lc.connect("lc_from_Flex");
stop();You can only have 1 LocalConnection per sender/receiver. If I
have 2 SWFs, A and B. If I want A and B to send messages to each
other, I need 2 LocalConnections. If I have 3 SWFs and want
bi-directional communication between all of them, I'd need 6
LocalConnections. Add a 4th SWF and you'll need a total of 12 and
so forth. -
Load and control AS2 interactive SWF in AS3 and get properties of AS2 swf
Hi,
Can anyone please tell me how to load AS2 and AS3 swf file in AS3 Loader class. I have tried "ForcibleLoader.as, AVM1Loader.as, AVM2Loader.as but as of now I have not get successes yet. There are some issue in all library.
I am looking for below solution.
1) Load SWF file AS2, AS3 via flashVars params and load it in AS3 player.
2) After successfully loaded, below properties should be shown -
a) totalFrames
b) currentFrames
c) FPS of loaded swf file
d) Should wok play(), stop() properties of loaded swf file.
e) SWF file should work just like video player application where we can do Play, Pause, Stop, Seek (All properties and methods
should be supported. )
3) Player should be capable of loading all swf file regardless of any version AVM1 AVM2 both in AS3 Player.
4) After loading player should scale external loaded swf file as per Player stage width and height and content should be scale
proportionate in 4:3.
4) AS2 & AS3 action script must be supported in AS3 player. (All interactive swf file should be supported)
Thankshttp://gskinner.com/blog/archives/2007/07/swfbridge_easie.html
Maybe you are looking for
-
Really sick of the T400 - I miss my T61! Shame on Lenovo for leting this Beta laptop out!
From day 1 since I got this expesive brick, there have been problems. 1. Fingerprint reader on almost everybody's T400 malfunctions. 2. Litterally 50% of the time that I try to shut down, hibernate, or standby, the system gets stuck in the proccess,
-
Importing flash symbols from an external SWF using URLrequest
Hello. I'm trying for several days now to properly import flash symbols into a flex application. i can't only @Embed because the swf file that contains the skins will not be available locally so i need to use URLRequest. This is what I've got so far.
-
Is there any good categorization/tagging software?
I want to make a list of movies, tag them based on genre, and be able to search the tags (like in iTunes). I make a lot of lists, and being able to tag them all would help a lot in schoolwork and so on. Does anyone know of a good user-friendly progra
-
I have to drag horizontally graphics but I need to do some easing effect like this: http://www.newcruelty.com/TNC_site_1.2.swf Can you tell me how to make this effec when release de mouse? thank you very much
-
Driver updates from vendors or Apple?
Hello! quick question... I am running bootcamp 4, and Win7 is alerting me there is a newer driver available for the video card on my MBPr. Is it reccomended to only use the "Windows Support" download file from apple when updating windows drivers?