Loading AS2 mc's into AS3 movies
Hi. Using the following code to import AS2 mcs into AS3.
var contenedor = new Loader();
contenedor.load(new URLRequest("animal_catch2.swf"));
addChild(contenedor);
contenedor.x = 100
contenedor.y=0
BUT doesn't work too well. Games don't work but and the image is displaced. Would appreciate any help.
Thanks in advance.
Sorry, excuse me. The displacement was becuase I cut and pasted the and I've just seen x = 100.
Anyway, the game still doesn't work.
Also, even if mcs are imprted and have different sizes than the container, can't they fill the container anyway - with fullscreen or something.
Similar Messages
-
How can I load an external SWF into a movie clip that's inside other movie clip?
Hi.
I creating my first flash (actionscript 3.0) website but I'm
stuck with a visual effect I want to create.
I have a window on my website called contentWindow. Every
time you click a button this window is supposed to leave the stage,
load the requested content and return to the stage.
The sliding window is a movie clip with 83 frames, 21 to
enter the stage, 21 to leave the stage again, 20 for nothing (its
just to simulate the loading time) and 21 to return to the stage.
Now my goal is, when the user clicks on a navigation button,
the window exits the stage, loads an external SWF with the content,
and then returns to the stage.
I've the "window" movie clip with an instance name of
"contentWindow". Inside there is another movie clip with an
instance name of "contentLoader". The content that the user
requested should appear inside the "contentLoader".
Now, when the contentWindow leaves the stage, I get this
error message:
quote:
TypeError: Error #1009: Cannot access a property or method of
a null object reference.
at rwd_fla::MainTimeline/trigger()
If I switch
"contentWindow.contentLoader.addChild(navLoader);" for
"contentWindow.addChild(navLoader);" it works fine, but the
external SWF doesn't move with the window.
How can I load an external SWF into a movie clip that's
inside other movie clip?Hi,
Recently, I have been putting together a flash presentation.
And I am just wondering if the following might help you, in your
communication with the said swf file:
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
onComplete);
function onComplete(event:Event):void
event.target.content.thinggy_mc.y -= 100;
Not the best example, but this allows you to target a mc
within an external swf file. I think if you look up this code, you
will have an answer ;)
Kind Regards,
Boxing Boom -
Loading as2 swf files into as2
i had load my swf file with as2 and i like to add controls like play pause stop time slider for its pls help me with some examples ........................
use google to search for a tutorial about as2 timeline control.
if you need help with code you're trying to implement, ask here. -
Problem going to fullscreen after loading AS2 movie into AS3
I've got a loader movie that is written in AS3, and
fullscreen is enabled. I have a context-menu fullscreen trigger and
a keypress fullscreen trigger built into the loader movie. When I
load an AS3 movie or an AS1 movie through the loader movie, I can
go to fullscreen without problems. When I load the AS2 movie, I
cannot.
Does anyone have an idea why this might be? I'm struggling.
Thanks in advance.Thanks for your help, but as said ("But also using a
separated second loader to load the second file is not working.")
even when using a second loader (with a different name) the second
file loaded will not work.
I'm removing any EventListener from the first loader,
unloading and then nulling it.
But to me it seems, that the first content is not garbage
collected and because of that, even when loaded with an other
loader the first loaded swf-file interferes with the second.
I came to this conclusion, because the first loaded swf-file
is still working after trying to load the second file. And just
more weird: the first loaded file is in the same state and also
after closing the Flash-Player.
You can see it for yourself: download the testcase. Start the
testcase.swf. Load a contentfile. Skip a few pages. Quit the Flash
Player. Start the testcase.swf again and load the same contentfile.
You will see it's at the same position like before quiting the
Player.
And I can't help, but that seems like a bug to me... -
FlashVar to as2 loaded into as3
I am afraid I already know the answer to my question but I am
hoping otherwise. Previously an AS2 movie loaded into an AS2 movie
could get flashvar values through _level0 or _root. My problem is
having an AS2 movie loaded into an AS3 movie and still letting the
loaded AS2 have access to the flashvars. I can successfully get the
flashvars into the AS3 movie so that isn't an issue. I searched
around and couldn't find any posts that helped and if this has
already been covered I would appreciate a point in the right
direction.First off thank you for your replies, links and help.
So my fears were correct, there is no easy solution. I was
hoping that I could use loader variables to load flashvars to the
loaded clip or something where I could still have the as2 continue
to use _level0. The reason for keeping _level0 is the classic "I
don't want to rewrite everything."
Thanks again. -
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
> -
How do you load an AS2 swf into AS3?
I think this is the way around my dilemma. How do you load and AS2 .swf into an AS3 file?
thanks again!
Stevecheck that code in your last thread:
What is the code to load a .swf file in AS3 on the same layer? -
Problems with loading AS2 assets into AS3 container
Hello,
in a Project I use the AS3 Loader Class to load
AS2-swf-files. The swf-files are placed into different subfolders,
since they're using the same filenames and subfoldernames for
config-files etc.
The Problem is: Whatever swf-file I load first, it is
working, but every swf-file after that fails. It seems to be
loaded, but it's not working correctly.
I'm using the attached code (easy as it seems) to unload the
present content and then loading the new one. But also using a
separated second loader to load the second file is not working.
I made some kind of testcase (a loader with 2 content
swf-files) for you, so you can understand what I'm talking about.
Here you can download the
testcase (28
MB).
It seems like there is a bug in the flash player 9 that
prevents the AS2-content from being unloaded correctly from an AS3
file. Can you confirm that there is such a bug? Or do you have an
explanation for this behavior? Or even better: a solution or
workaround?
Thanks a lot!Thanks for your help, but as said ("But also using a
separated second loader to load the second file is not working.")
even when using a second loader (with a different name) the second
file loaded will not work.
I'm removing any EventListener from the first loader,
unloading and then nulling it.
But to me it seems, that the first content is not garbage
collected and because of that, even when loaded with an other
loader the first loaded swf-file interferes with the second.
I came to this conclusion, because the first loaded swf-file
is still working after trying to load the second file. And just
more weird: the first loaded file is in the same state and also
after closing the Flash-Player.
You can see it for yourself: download the testcase. Start the
testcase.swf. Load a contentfile. Skip a few pages. Quit the Flash
Player. Start the testcase.swf again and load the same contentfile.
You will see it's at the same position like before quiting the
Player.
And I can't help, but that seems like a bug to me... -
LocalConnection between AS3 App into Loaded AS2
So I have an app that loads an AS2 Compiled SWF into it.
The Main App (AS3)
// the SWFLoader loads the ChildSWF, and on (Event.COMPLETE, openLocalConn);
private function openLocalConn(e:Event):void {
my_send_lc = new LocalConnection();
my_send_lc.send("ConnCountryList", "publicMethod", "jo");
my_send_lc.addEventListener(StatusEvent.STATUS, onStatus);
private function onStatus(event:StatusEvent):void {
switch (event.level) {
case "status":
trace("**** LocalConnection.send() SUCCESS ****" + event.toString());
break;
case "error":
trace("**** LocalConnection.send() FAILED ****");
break;
Loaded SWFChild (AS2)
trace ("Loaded Child SWF");
var getArray_lc : LocalConnection = new LocalConnection();
getArray_lc.client = this;
getArray_lc.connect("ConnCountryList");
getArray_lc.allowDomain('*');
function publicMethod(jo:String) {
trace('Eureka');
So When I run the MainApp, The ChildSWF gets Loaded (traceout: Loaded Child SWF, it's calls the openLocalConn(), it Gives me another traceout: **** LocalConnection.send() SUCCESS ****,
BUT I GET no traceout for the called publicMethod() in the ChildSWF in which I am supposed to see: EurekaLocalConnection will only work between two applications running on the same machine.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/LocalConnecti on.html
"LocalConnection objects can communicate only among files that are running on the same client computer, but they can be running in different applications — for example, a file running in a browser and a SWF file running in Adobe AIR."
If you need to communicate between an app running on an iOS device and a swf in a browser on a computer look into the ServerSocket Class:
http://help.adobe.com/en_US/air/reference/html/flash/net/ServerSocket.html
Works a little differently than LocalConnection but will allow connections between two different physical devices (ie: 2 computers, a computer and a mobile device, 2 mobile devices, etc). Since the iOS device uses the air runtime stuff it should have access to the ServerSocket Class while the browser swf can use a standard Socket to connect to the iOS device. -
LoadMovie- loading an external swf into movieclip in AS3
Im extremely frustrated.........im trying to do something
that was once very simple, which has now become over complicated
unecessecarily.....i want to do a simple loadMovie type action and
load an external clip into a movieclip called ph. my AS2 code would
be:
loadMovie("ExternalMovieClip.swf","ph");
or
on(release) {
loadMovie("ExternalMovieClip.swf","ph");
This no longer works. Can somebody tell me the new code that
i would use with AS3 to do exactly what i just demonstrated? I
honestly dont even want to touch AS3. The only reason i want to use
it is because it makes skinning the components SOOOOOO much easier
than AS2. That is the one and only reason im trying to convert to
AS3. All the new load movie AS3 examples ive seen on google look
like half a page long to do what i used to do in 2 lines. There
must be a simpler and much easier way. I am a designer. It looks to
me like Adobe went back to making flash for programmers only again
leaving us designers out of the mix. Someone please help me, im
desperate. I also have other old code that im sure im going to have
to convert to AS3 for it to still work, and i may eventually need
help with that as well, but ill stick with this loadMovie problem
for now. Any and all help is appreciated. Thankshave a look here:
http://www.smithmediafusion.com/blog/?p=381
use this:
var i =new Loader();
i.load(new URLRequest(”yourSwf.swf”));
myMC.addChild(i)
myMC is the name of your clip on the stage.
Dan Smith > adobe community expert
Flash Helps >
http://www.smithmediafusion.com/blog/?cat=11
http://www.dsmith.tv -
I'm loading AS2 movies in a AS3 environment, using a Loader.
Movies load, but they loose some onRelease handlers. This behaviour
is consistent. Some onRelease handlers in the AS2 work (all the
time), some not. Anyone have the same experience or is there a
solution?just ran across this note from the docs:
"If the loaded content is an AVM1 SWF file (written using
ActionScript 1.0 or 2.0), it cannot be cross-scripted by an AVM2
SWF file (written using ActionScript 3.0). However, you can
communicate between the two SWF files by using the LocalConnection
class."
might want to check into the LocalConnection class. you may
be able to construct some methods to pass values, but you still
will not be to 'script' from one version to another - however if
you're clever with you method construction you may be able to
utilize data gathered within the AVM1 by a AS2 script and pass it
for use in the AVM2 script. -
Making a loaded swf-file loading images into the movie..
Trying to convert my problem from norwegian into english
isn't always that easy... :)
Anyway..
I've created som cool buttons that I want to be loaded into a
movie (let's call i MainMovie.swf) and from there I want the
buttons to be able to load images into a movieclip (ImageContainer)
inside the MainMovie.swf.
Is it possible to make the MainMovie.swf communicate with the
the loaded buttons (each button is a swf-file containing the
actionscript, objects, etc.) so when the buttons are clicked they
load different images into the ImageContainer?
My idea here is to include an as.file into the MainMovie.swf
as well containing the url's to the images that I want to be loaded
into ImageContainer.
I've tried to create a button on a layer above the buttons
that's loaded into the MainMovie.swf but I end up with the loaded
buttons not working properlu because of the button that I've
created and placed above them.
Now, I don't want the url's inside the buttons thats loaded
into the MainMovie.swf as I want the ability to be able to replace
those buttons-files without having to use too much time writing the
url's in each button.
Thanks folks.are all your swfs using as3 or as2? if as3, you won't be
loading into a movieclip: you'll use a loader instance and you can
reference (or communictae with) the loaded as3 objects using the
content property of your loader once you cast it as a
movieclip. -
Hi, I am trying to create a scrollbar for a movie using a
tutorial I found online (
http://www.flashkit.com/tutorials/Interactivity/Scrollin-Jake_Gel-683/index.php).
My problem is that I am new and am having issues translating the
AS2 script into AS3. Is there anyone who could help me translate
this:
onClipEvent (load) {
diff_y = bound_box._height-scroller._height;
bounds = bound_box.getBounds(this);
top = bounds.yMin+(scroller._height/2);
bottom = bounds.yMax-(scroller._height/2);
function updateScrollbar () {
content._y =
-(((scroller._y-top)/diff_y)*(content._height-bound_box._height));
onClipEvent (mouseDown) {
if (scroller.hitTest(_root._xmouse, _root._ymouse)) {
startDrag ("scroller", false, scroller._x, top, scroller._x,
bottom);
scrolling = true;
// here we stop the drag and set scrolling to false
onClipEvent (mouseUp) {
stopDrag ();
scrolling = false;
onClipEvent (enterFrame) {
if (scrolling) {
updateScrollbar();you have a 4 enterframe loops running continually when they
only need to run after a menu item has been clicked and can stop
after all menu items have reached their final positions.
and you need to compute the final positions for each menu
item after one of them is clicked.
you might do better to check for an as3 tutorial for an
accordian menu. it's a bit more involved than you're thinking. -
Loading external SWF's into an SWF Loader as3 style?
Hi,
I've recently made the switch from as2 to as3 and am still struggling to get my head around one aspect in particular. I've managed to load one external swf into a blank file via the script
import LoadDisplayObject;
var loader:LoadDisplayObject = new LoadDisplayObject("button_01.swf", true);
loader.addEventListener("displayObjectLoaded", onComplete, false, 0, true);
addChild(loader);
function onComplete(evt:Event):void {
trace("loaded complete received");
loader.scaleX = loader.scaleY = .75;
.....however I'm struggling with the script to make a swfs load into a space when one of my 3 buttons is clicked....
My page currently has three buttons (button_01, button_02 and button_03) and in a local folder three separate swfs with the same names which I wish to load in, when the appropriate button is pressed.
I have managed to get them to load in using a tutorial...however they load over the top of each over...far from ideal. From research on the internet I've found a range of different script...but I just can’t find anywhere I can find script to make this work..hence why I have turned to here.
Any help much appreciated...thanks in advance.Hi,
Just throught I would let you know that I've manged to get this to work this morning. Changed the script slightly and used a different method of:
var home:MovieClip = this;
function butt1Click(evt:MouseEvent):void {
var ldr:Loader = new Loader();
ldr.load(new URLRequest("button_01.swf"));
ldr.contentLoaderInfo.addEventListener(Event.INIT, loaded);
function butt2Click(evt:MouseEvent):void {
var ldr:Loader = new Loader();
ldr.load(new URLRequest("button_02.swf"));
ldr.contentLoaderInfo.addEventListener(Event.INIT, loaded);
function butt3Click(evt:MouseEvent):void {
var ldr:Loader = new Loader();
ldr.load(new URLRequest("button_03.swf"));
ldr.contentLoaderInfo.addEventListener(Event.INIT, loaded);
function loaded(evt: Event):void {
if(contentClip.numChildren > 0){
contentClip.removeChildAt(0);
contentClip.addChild(evt.target.content);
button_01.addEventListener(MouseEvent.MOUSE_UP, butt1Click);
button_02.addEventListener(MouseEvent.MOUSE_UP, butt2Click);
button_03.addEventListener(MouseEvent.MOUSE_UP, butt3Click);
seems to work well. Only small question is if I want one page to load automatically upon opening...how do I alter the script to do this??? Thanks -
External as2 userDrawingTablet into as3
created a tablet where the user could draw on the pad. i did it a while ago using actionscript 2. now i'm loading it externally into as3. when placed in as3 it seems to be confused as to where the tablet is and draws only on the bottom right and off the page. also have a text function that is not working properly either.
kind of a random application and random problem, but not sure where else to go with this...
was just wondering if anyone had done this and had a similar problem?
thanx"submitter" is a movie clip on the main timeline. this code is inside submitter layed out with a mc named "blackboard". blackboard has a mc named "innerBlackboard" inside of it.
blackboard.clearChalk = function():Void {
var cl = this._parent._parent.chalkLine;
this.createEmptyMovieClip("chalkLayer", 0);
this.chalkLayer.lineStyle(cl.thickness, cl.color, cl.alpha);
this.drawings = [];
blackboard.clearText = function():Void {
this.createEmptyMovieClip("textLayer", 10);
this.textfields = [];
blackboard.clearAll = function():Void {
this.clearChalk();
this.clearText();
blackboard.enterDrawMode = function():Void {
this.innerBlackboard.onPress = this.startDraw;
blackboard.startDraw = function():Void {
var x:Number = Math.round(this._xmouse);
var y:Number = Math.round(this._ymouse);
var coordinates = [x + "," + y];
this._parent.currentDrawing = coordinates;
this._parent.drawings.push(coordinates);
this._parent.chalkLayer.moveTo(x, y);
this._parent.onMouseMove = this._parent.drawChalk;
this.onRelease = function() {
delete this._parent.onMouseMove;
blackboard.endDraw = function():Void {
delete this.onMouseMove;
delete this.innerBlackboard.onRelease;
blackboard.drawChalk = function():Void {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
var x:Number = Math.round(this._xmouse);
var y:Number = Math.round(this._ymouse);
this.currentDrawing.push(x + "," + y);
this.chalkLayer.lineTo(x, y);
} else {
this.endDraw();
updateAfterEvent();
blackboard.enterTextMode = function():Void {
this.innerBlackboard.onPress = this.startText;
blackboard.startText = function():Void {
var d:Number = this._parent.textLayer.getNextHighestDepth();
var x:Number = this._parent._xmouse;
var y:Number = this._parent._ymouse;
this._parent.textLayer.createTextField("t" + d, d, x, y, this._parent.width - x, this._parent.height - y);
var tf:TextField = this._parent.textLayer["t" + d];
this._parent.textfields.push(tf);
tf.type = "input";
tf.multiline = true;
tf.wordWrap = true;
tf.restrict = "^'<>";
tf.setNewTextFormat(this._parent._parent._parent.chalkFormat);
tf.embedFonts = true;
tf.text = "Type message";
Selection.setFocus(tf);
Selection.setSelection(0, tf.text.length);
tf.onKillFocus = function() {
this.type = "dynamic";
this.selectable = false;
blackboard.formatEntry = function():String {
var tf:TextField;
var d:Object;
var entryXML = "<entry>";
entryXML += "<text>";
for (var i:Number = 0; i < this.textfields.length; i++) {
tf = this.textfields[i];
entryXML += "<field x='" + tf._x + "' y='" + tf._y + "' text='" + tf.text + "' />";
entryXML += "</text>";
entryXML += "<drawings>";
for (i = 0; i < this.drawings.length; i++) {
d = this.drawings[i];
entryXML += "<drawing coordinates='" + d.join("|") + "' />";
entryXML += "</drawings>";
entryXML += "</entry>";
return escape(entryXML);
blackboard.clearAll();
blackboard.innerBlackboard.useHandCursor = false;
blackboard.width = blackboard._width;
blackboard.height = blackboard._height;
draw_bn.onRelease = function() {
blackboard.enterDrawMode();
text_bn.gotoAndStop("_Up");
text_bn.enabled = true;
this.gotoAndStop("_Down");
this.enabled = false;
text_bn.onRelease = function() {
blackboard.enterTextMode();
draw_bn.gotoAndStop("_Up");
draw_bn.enabled = true;
this.gotoAndStop("_Down");
this.enabled = false;
clear_bn.onRelease = function() {
blackboard.clearAll();
submit_bn.onRelease = function() {
var name:String = name_if.text;
if (name == "" || name == "name (required)") return;
var email:String = email_if.text;
if (email == "" || email == "email (required)") return;
entry = new LoadVars();
entry.name = name;
entry.email = email_if.text;
entry.message = blackboard.formatEntry();
returnEntry = new LoadVars();
returnEntry.onLoad = traceReturn;
entry.sendAndLoad("submitEntry.php", returnEntry);
function traceReturn() {
if (this.result == "success") {
blackboard.clearAll();
name_if.onSetFocus = email_if.onSetFocus = function() {
this.text = "";
delete this.onSetFocus;
name_if.restrict = email_if.restrict = "^'<>";
Maybe you are looking for
-
21" Imac suddenly stopped finding the wireless mouse (with new batteries)
Despite my changing the batteries in the wireless mouse, and despite the fact that the Bluetooth is working with my wireless keyboard, I can't get the IMac to recognise and connect with the wireless mouse. Any ideas?
-
PowerBook Alu-The painting flaked - Has anyone been in a similar situation
NOTICE : English version follow Je recherche toute personne qui connait une situation similaire et/ou si une solution a été trouvé ou résolu entre Apple et vous ? Moins de 6 mois après l'achat de mon PowerBook, il est survenu un défaut dans le pannea
-
How do you highlight several cells with the mouse in numbers
how do you highlight several cells with the mouse in numbers
-
Unable to Install jdevstudio11113install.exe on Windows 2003 IA64
Hi there, I was trying to install jdeveloper 11.1.1.3.0 on ia64 windows 2003, and I kept getting error when installing: Java Virtual Machine Launcher Could not create the Java virtual machine. Is this jdev supported on the machine/OS version? Thanks!
-
Global defination ...in smart forms..
hi all 'smart forms' gurus... how to declare table fields in global defination wat is to rite under variable name and associated type..