Globals in crossdomain swf's (AS2)
Hi,
I have two domains (on the same server) each of the domains
contains a crossdomain xml and swf's. The swf's have
System.security.allowDomain("*") set.
From 'domainOne' I start the main swf. This main swf loads
(with a loader component) a swf from 'domainTwo'. So var so good.
In the main swf on 'domainOne' I have some _global functions.
When I call these global functions from the second swf (from
'domainTwo') nothing happens.
My question: Is it possible to call global functions between
crossdomain swf's? If so, what's the trick?
Thanks
I have found something that could be the problem:
http://www.adobe.com/devnet/flash/articles/fplayer_security_04.html
It says:
quote:
When two movies are from different domains, Macromedia Flash
Player ensures that the two movies have different copies of the
ActionScript global object. The global object is usually implicitly
referenced. For example, all objects in the Macromedia Flash Player
standard library, such as MovieClip, Array, and so forth, are part
of the global object. The global object also holds global variables
created by assigning properties to _global. Separating global
objects between movies from different domains has occurred since
Macromedia Flash Player 6. However, Macromedia Flash Player 7
introduces a new restriction: movies made for Macromedia Flash
Player 6 or earlier can never share a global object with movies
made for Macromedia Flash Player 7 or later, even when the movies
are from the same exact domain and protocol. This may have subtle
repercussions for sites that mix movies made for Macromedia Flash
Player 6 and 7.
But I find this very stange, especially if you use
System.security.allowDomain(); this should grant the swf access. Or
am I wrong here? (I only use player 8 files, thus no mixed ones)
Any ideas?
Similar Messages
-
I purchased a flash template written in AS2, i have all files needed to customize this site, .fla, psd's you name it. I also purchased a photo gallery that is written in AS3 (did not know it was AS3 when purchased) . My question: is there any way to embed/nest the AS3 photo gallery, which i the swf file for, into my AS2 website?
Per AS3 documentation:
A single SWF file cannot combine ActionScript 1.0 or 2.0 code with ActionScript 3.0 code.
SWF files written in ActionScript 1.0 or 2.0 cannot load SWF files written in ActionScript 3.0. This means that SWF files authored in Flash 8 or Flex Builder 1.5 or earlier versions cannot load ActionScript 3.0 SWF files.
The only exception to this rule is that an ActionScript 2.0 SWF file can replace itself with an ActionScript 3.0 SWF file, as long as the ActionScript 2.0 SWF file hasn't previously loaded anything into any of its levels. -
Strange behaviour of .swf movies - AS2/AS3
Hello from Italy,
this is my first post and I think I need some help from the experts...
I am putting together an interactive Flash movie which is made of several different small movies. For the sake of clarity, I'll call them A.swf, B.swf, ..., Z.swf. The movies are launched from each other depending on certain buttons I've implemented.
The first one, A.swf, is actually a sort of "main menu": it grants access to all the other movies and it is also the point of return from them when a certain button is pressed.
Important: All the movies are scripted in AS3, except for the last one which, for a number of reasons, is scripted in AS2.
The return from any (but the last) movie to the first, say B.swf to A.swf, is implemented like this:
function eventResponseSole(event:MouseEvent):void {
var myLoader:Loader = new Loader();
addChild(myLoader);
var url:URLRequest = new URLRequest("A.swf");
myLoader.load(url);
sole_btn.addEventListener(MouseEvent.CLICK, eventResponseSole);
This is, of course, AS3.
The last movie, which is scripted in AS2, returns to A.swf like this:
luna_btn.onRelease = function() {
loadMovie("A.swf", _root);
The strange behaviour is this: if I launch Z.swf and navigate with the proper button up to A.swf, everything works. But if I launch A.swf, navigate to Z.swf and attempt to return, this doesn't work. There are no problems, instead, moving up and down between movies scripted in AS3, that is with the first bit of code I've pasted. My guess is that the syntax in AS2 is correct, but something stops A.swf from "launching itself" when the control is transferred to Z.swf, but the movie is launched in the original window. Is this diagnosis reasonable? And if so, would someone kindly provide a way out of this? Re-doing Z.swf in AS3 is not an option, I'm afraid, it will have to stay as it is. I also have to add I've tried some solutions by setting _lockroot, but this doesn't seem to work.
Many thanks in advance!
Marco OlivottoMixing AS2 into AS3 is not without stipulations... and I am no expert on translating those stipulations, but here is what the Flash documentation says regarding the matter... the third paragraph may be significant to your case:
- ActionScript 3.0 code can load a SWF file written in ActionScript 1.0 or 2.0, but it cannot access the SWF file's variables and functions.
- SWF files written in ActionScript 1.0 or 2.0 cannot load SWF files written in ActionScript 3.0. This means that SWF files authored in Flash 8 or Flex Builder 1.5 or earlier versions cannot load ActionScript 3.0 SWF files.
The only exception to this rule is that an ActionScript 2.0 SWF file can replace itself with an ActionScript 3.0 SWF file, as long as the ActionScript 2.0 SWF file hasn't previously loaded anything into any of its levels. An ActionScript 2.0 SWF file can do this through a call to loadMovieNum(), passing a value of 0 to the level parameter. -
Using Captivate 4. Tried to load two swf files and had two separate results.
First one - Action Script 2. In the first window to open, it begins playing, but when I open and the "new animation" window opens to apply it, it says it only has one (1) frame. When I apply, it doesn't play on the slide. Made with Flash 8.
Second one - AS3. In the first window to open, it begins playing, but when I open it says project is AS2 and needs to be changed to add. I select continue and it shows the file having 65 frames. Made with Flash 10.
Any idea why my first swf doesn't play even though I have an option between an AS2 or 3 project.
Thanks!Well, I'm gonna answer my own post here.
I added this code to the first frame of the loaded SWF and
things seem to be working swimmingly.
this._lockroot = true
G -
Can I load AS3 swf in AS2 file
I have downloaded a xmlphotoalbum (www.xmlphotoalbum.com) which is in AS3 and uses lots of external classes and functions,
I am trying to load it withing a AS2 movie but it's not running and it is not giving me any errors.
how can I make this run?
would you please download the xmlphotoalbum and try it?
I am not using an AS3 file to load the xmlphotoalbum because I don't know how to handel AS3 and load external swf files and play then and then unload them.
I have tried using the get ulr and addchild() fucntions. but since I am not experienced it AS3 it's bit confusing for me and also I dont know how to control the playback of the loaded swf files.
I am doing all this for a CD presentation, not a a web site.Hi there
You are probably wanting help with Flash.
Although this forum says "FlashHelp", what it is for is an output type from a product called RoboHelp.
Click here to visit the Flash community
Cheers... Rick
Begin learning RoboHelp HTML 7 within the day - $24.95!
Click here for Adobe Certified Captivate and RoboHelp HTML Training
Click here for the SorcerStone Blog
Click here for RoboHelp and Captivate eBooks -
Loading external AS2 SWF in AS2
I want to load the external SWF file which is in AS2 in to my
SWF file which is also in AS2.. The problem I am facing is I am
able to load external SWF but I am not able to pass the Flash vars
to that SWF.. Here is my Code
var _mcl:MovieClipLoader = new MovieClipLoader();
var _listener:Object = new Object();
_listener.onLoadInit = function(_mc:MovieClip)
trace("Done loading...");
_mcl.addListener(_listener);
this._mc1.removeMovieClip(clip_1);
this.createEmptyMovieClip("_mc", this.getNextHighestDepth());
_mcl.loadClip("
http://www.xyz.com/xyz/xyz.swf?200711900&local=true",
_mc);
So the xyz.swf is not able to read the variable local I am
passing as a flash variable..
So how can I accomplish passing flashvars to this xyz.swf
ThanksI don't know if you can pass variables this way, but since
you are hard coding them in AS why not pass them directly to _mc
once your .swf has loaded? -
Javascript error when using ExternalInterface.addCallback with crossdomain swf file
how can i use ExternalInterface.addCallback when using
javascript access from Server A (html) to Server B (swf) ? coz it
showing error?
Server A
192.168.0.10/XXX/example.html
===========
<object
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
id="MGSInsurances1" width="960" height="600"
codebase="
http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
<param name="movie" value="
http://192.168.0.22/MGS/flex/MGSInsurances1.swf"
/>
<param name="quality" value="high" />
<param name="bgcolor" value="#869ca7" />
<param name="allowScriptAccess" value="always" />
<embed src="
http://192.168.0.22/MGS/flex/MGSInsurances1.swf"
quality="high" bgcolor="#869ca7"
width="960" height="600" name="MGSInsurances1"
align="middle"
play="true"
loop="false"
quality="high"
allowScriptAccess="always"
type="application/x-shockwave-flash"
pluginspage="
http://www.adobe.com/go/getflashplayer">
</embed>
</object>
<script language="javascript">
window.MGSInsurances1 =
document.getElementById('MGSInsurances1');
</script>
Server B
192.168.0.22/MGS/flex/MGSInsurances1.swf
==================
Security.allowDomain("*");
if(ExternalInterface.available)
ExternalInterface.addCallback("onchange",onchange);
ExternalInterface.addCallback("datachange",datachange);
but javascript Error is showing "Unknown name", how can i fix
it? urgent! somebody know this?i solved it! because i havent restart my server again! No
Error again ! sorry for bothering everybody. -
Load external swf thats AS3 in a AS2 swf
i have a website made in actionscript 2, and now i need some
functions from actionscript3 that actionscript 2 doesnt have, so im
trying to load a external actionscript 3 swf in to a actionscript 2
swf, is this possible?
im using _root.mc.loadMovie("ms.swf");
cuz it doesnt seem to workah ok thanks
have any idea how to load text into swf in AS2.0 without
having a tag like text= ... because as far as i know only AS3's
URLLoader can do it. -
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. -
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. -
As2 for load movieclip swf file
im having a problem..i,e. i need to load an external swf which is in as3...and need it to be played in my as2 swf layout. with a time slider ,play, pause ,next, previous for that swf movie clip. pls give ur mail id i can sent my original files....................pls help me
download tis jpg image and convert to rar r zip file.....AS2 and AS3 are incompatible. Although you can load AS2 into AS3 - you CANNOT load AS3 swf into AS2.
-
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
-
Embedded AS3 SWF access in Flex 2
I have an SWF (Action Script 3) created in Flash 9 Alpha
Public.
I can access all its methods and variables when using
SWFloader, but fail to do so when embedding it by using [Embed]
tag.
I need to do it to use it as a custom cursor (CursorManager
accepts objects of Class type as cursors). Before I was using SWF 8
(AS2) with LocalConnection, but since the new SWF 9 is in Action
Script 3, I want to use it directly.
The code looks like this:
[Embed(source = "cursor_9.swf")]
private var newCursorSymbol:Class;
private function changeCursor(event:MouseEvent):void
CursorManager.setCursor(newCursorSymbol);
The question is. Can I, and if I can, then, how, access this
swf methods from within a Flex 2 application?
or else, can the CursorManager somehow accept the content of
SWFloader, which is a MovieClip object?
Thank youThis is tough. The DisplayObject that represents the customer
cursor is instantiated internally by the CursorManager and is
stored in a private variable, so there's no way to get at it. I
believe there is a hack you can do if you ever only have one
instance of that cursor. The Class you pass to the CursorManager
can be any DisplayObject, so you can cook one up to wrap your SWF.
For example, call it MyCursor.mxml:
<mx:Canvas xmlns:mx="...">
<mx:Script>
<![CDATA[
public static var sCursorLoader: SWFLoader;
]]>
</mx:Script>
<mx:SWFLoader id="loader" source="cursor_9.swf"
creationComplete="sCursorLoader = loader"/>
</mx:Canvas>
And then use the CursorManager:
CursorManager.setCursor(MyCursor);
The idea is that once the CursorManager instantiates the
MyCursor class, the static variable will point to the SWFLoader, so
you can access it in a global way:
MyCursor.sCursorLoader
Of course, you'll have to put in some kind of delay to make
sure the SWF is completely loaded, etc. This is just something I
thought of off the top of my head, so take it with a grain of salt.
:-) -
I've created a 'plugin' SWF file in CS3 using actionscript 3.
The purpose of this file is to be included as a postroll in the
open source flash media player JW FLV/Media Player (
http://www.jeroenwijering.com/?item=JW_Media_Player).
I have heavily customized the media player libraries to do
various new things/alter how things worked, and now want to be able
to include the SWF file within this into a child sprite/movie clip.
HOWEVER, the problem lies in that the media player is written
completely in AS2, and therefore I have to use the MovieClipLoader
class to load in the SWF. Updating the source to AS3 isn't an
option unfortunatly, and downgrading the AS3 SWF to AS2 isn't an
option either, mainly due to the fact I've learnt AS3, not AS2, and
find it frustrating trying to find the AS2 equivalent to the AS3
methods I know.
The problem though lies in that MovieClipLoader does not like
my SWF at all. Initially I was presented with a load of sandbox
errors from when it was loaded in, which I then resolved so that no
security errors are produced. However, whenever I load in the clip,
the target sprite/clip is empty. I have gone through checking that
no errors occur on load, and it reports that the loaded SWF has
been initialized, yet I see nothing. Also, the code loading the SWF
is not at fault as it loads any other SWF (even another AS3 SWF
which just creates a rectangle) no problem.
Oddly enough, using the MovieClip.loadMovie method works in
one situation - when you load it into the root of the AS2 file.
When loading it into an empty movie clip, the same problem of a
blank clip occurs. The problem is not specific to the media player
either, as it happened in any AS2 file where I was testing how to
load in the AS3 SWF.
If it is of any use, the sandbox errors produced by the AS3
file when loaded into AS2 swf I had to resolve where to do with
stage access for getting the stage height and width, and a
Loader.content error when pulling out the BitmapData. These were
resolved via setting the allowed domains policy and eliminating any
reference to stage.stageHeight/With.
Does anyone have any ideas on how to solve this? The only
possible solution I've been able to think of so far since the AS3
swf won't display is to play with the LocalConnection class as
tests showed I can communicate between the AS2 and AS3 files, but
this would have to be a last resort, and is less than ideal when
there can be multiple instances of the player running (I would need
to use unique connection names for each instance so as to prevent
player A interacting with player B, and also as only one of the
players can listen on the connection at once).I have the component in the top level also,
I get this error:
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/drawBackground()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\controls\BaseButton.as:615]
at fl.controls::LabelButton/draw()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\controls\LabelButton.as:724]
at fl.core::UIComponent/drawNow()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\core\UIComponent.as:1343]
at fl.controls::List/drawList()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\controls\List.as:594]
at fl.controls::List/draw()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\controls\List.as:474]
at .tree::TreeList/draw()
at fl.core::UIComponent/callLaterDispatcher()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\core\UIComponent.as:1532]
I've checked the definitions for the tree component,
The LabelButton and List I don't have much control over.
I'm not sure how to fix this. The xml is correct and loads easily if it's in the root document.
The list component doesn't load the labels, It stops on the first one.
What do I do next? -
Biztalk as2 and x12 party testing on Testing Server
hi experts,
we are currently in testing env , we have lot of parties configuration on x12 and as2. the parties we have live partners identities.
while we testing the we facing the the party not found exception.
1. how to avoid party not found exception or as per testing way as of now.
2.otherwise i think we have to configure some dummy party , assing the where ever.
please any one put your inputs,.........
ThanksThanks Boat,Tanmoy,
Tanmoy your sounds make some approach 2 me, Plz put more clarity global party.
here we have as2 url and x12. how to we have create some global party for testing purpose only.
Thanks
Maybe you are looking for
-
My wife and I have iPhone 4S's but are currently sharing the same iCloud account. I would like to set her up with her own account but I would like to share contacts and photos on the iCloud. Is there a way to share this across 2 iCloud accounts? Th
-
My iPod touch is disabled but I no longer have a laptop to sync to - how do I fix it
My iPod touch is disabled but I no longer own a computer to sync it with - is there another way it can be fixed
-
I receive message the CC desktop needs to upgrade and the upgrade fails to complete
I have tried many times and the upgrade fails at the same place, almost to the far right end of the progress bar. I have downloaded to my PC and tried from there as well as the automatic upgrade the happens when I try to acces CC desktop. I'm running
-
Hi, I am trying to create something like an album for photographs in java. Each picture is about 1 MB JPEG. When I try to load them as thumbnails (using ImageIcon), I get OutOfMemoryException. As I understand, ImageIcon uses Image, which is represent
-
Why does Mail's mark-as-junk toolbar button show an icon of a Super 8 film camera?