ActionScript 2.0 :: Relative Or Absolute Adressing [fmx 2004]?
Apr 26, 2004
Im a bit confused about the adressing of .swf-files loaded into levels of another .swf-file.The adressing seem to be absolute, ie. if a sub.swf (which is loaded into a super.swf from another location) uses some sort of adressing (for instance, loading an image), that adress must include the path from the super.swf.
Cant you change that somehow, so that sub.swf's can adress other stuff relatively to its own adress?
Can you do that globally (so that relative adressing is used by every .swf)?Can you set it individually, so that adressing is relative only from the specified swf's?
I am new to Flash and ActionScript 3.0 environment. I don't have any knowledge in depth with Flash and ActionScript 3.0. I am using the flash(.swf file) in my Java application. Now, this .swf file is to be placed in the server system. While I am working with these, I faced an error. Here, my issue/problem(s) starts....
1.)With the help of URLRequest & URLLoader classes, I am loading a jpg file dynamically onto the stage using the following code:
I have doubt about relative and absolute path. I mostly use relative path to load xml, sound and image Is there any problem with cross domain policy?Which one is better in web projects?
I am working in Flash CS4. I have successfully run a .wmv file through the Media Encoder, converted it to a f4v file, imported it into Flash, and published it with a skin to a folder on my hard drive.I am learning this on my own (no one else in my state agency knows Flash - we are just getting started with posting videos on the Internet, and this is the test case).I get the following four files in one folder on my hard drive (I have put in parentheses what I think the files do, please correct if I am wrong):
oil.f4v (the movie file)
Test.html (the html page in which the swf file is embedded to play back the movie)
Test.swf (the swf file that is embedded in the html page)
SkinUnderPlayStopSeekMuteVol.swf (the skin file that is linked to from the Test.swf file??)
My question is: As long as these four files stay in the original folder, the html page plays the movie perfectly. As soon as I rename the folder, nothing works. It appears to be a question of re-establishing a relative/absolute link among the files? I want to post these to my live site in order to test, but of course that won't work yet either.
I have a bunch of Flash (.fla) files where I need to convert all absolute (root) target paths in timeline scripts to relevant relative ones. Doing it manually in Flash CS4 is very tedious work and using "replace" action is tedious too as there are multiple nested timelines. Is there any way to automate this task?
I am working with Flex, and I need to take a relative URL source property and convert it to an absolute URL before loading it.
The specific case I am working with involves tweaking SoundEffect's load method. I need to determine if a file will be loaded from the local file system or over the network from looking at the source property, and the easiest way I've found to do this is to generate the absolute URL.
I'm having trouble generating the absolute URL for sound effect in particular. Here were my initial thoughts, which haven't worked.
Look for the DisplayObject that the Sound Effect targets, and use its loaderInfo property. The target is null when the SoundEffect loads, so this doesn't work. Look at FlexGlobals.topLevelApplication, at the url or loaderInfo properties. Neither of these are set, however. Look at the FlexGlobals.topLevelApplication.systemManager.loaderInfo. This was also not set.
The SoundEffect.as code basically boils down to
var url:String = "mySound.mp3"; /*>> I'd like to convert the URL to absolute form here and tweak it as necessary <<*/ var req:URLRequest = new URLRequest(url); var loader:Loader = new Loader(); loader.load(req);
I would also be perfectly satisfied with some way to tell whether the url will be loaded from the local file system or over the network. Looking at an absolute URL it would just be easy to look at the prefix, like file:// or http://.
I'm attempting to use a relative path with SendAndLoad to my php query page named variables.php. Things seem to work just fine when I reference variables.php using an absolute path [URL], but variables are being returned as undefined when I attempt to call the page using just "variables.php." To add complexity, the swf is being referenced in an included page which is wrapped inside another page.
I know the path needs to be relative to the html/php page, not the swf itself. But what if the html page where the swf is encoded is actually being called from within another wrapper? I'm assuming the path needs to be relative to the final page, regardless. My guess is that the php isn't being parsed correctly when called via the relative path, which is the cause of my problem. Can anyone provide any insight? /dir/media/myflash.swf is called by /includes/myincludedswf.php which is then called by /home/final page.php if variables.php resides in the home directory, shouldn't I be able to use the path "variables.php" in the SendAndLoad directive?
However, it doesn't work. It works when I put the full absolute address, instead of simply "images/img1.jpg" . Is there any way to use a relative address?!?!? Probably attach the relative address to the URL property?
I have a problem that's driving me nuts. A real catch 22 it seems. I have a tutorial for creating a real cool mp3 player. The player shares url data ( allows others to embed the player among other things) so the addressing must be absolute. It works fine on my pc when I run from my local wamp server. Al my addresses are preceded with http://localhost. If I leave http://localhost in the url's it won't run on the server that I upload to and if I use the url from the server it won't compile. The addresses are in an xml file whiched is referenced in a class called PlayerDocumant the reference also uses an absolute address to reference the xml file.
Is there any way to rotate a 3D object in AS3 using absolute axes rather than the x, y and z axes of the object itself?For instance, increasing the value of rotationZ will make a movieclip rotate clockwise, but if the movieclip is first rotated 180 degrees around its y axis, increasing rotationZ will now rotate the movieclip counter-clockwise instead. Add rotation along the x axis, and things get really complicated.In my code, I simply want to flip a cube (consisting of four movieclip faces) 90 degrees around the default x and z axes, no matter what its current values of rotationX, rotationY and rotationZ are. My naive initial assumption was that it is only a matter of increasing rotationZ with 90 degrees to flip the cube left, or decrease rotationX to flip the cube "into" the screen
I looked around, and the latest reference I saw was from 2008 stating that the standard FileReference browser does not support retrieving the user's file's absolute local path unless it's an AIR app, and indeed there's nothing in the docs suggesting otherwise. The reasoning behind this is apparently some misguided security concern... I get it's not a great idea to let any Flash app know your directory structure, but if the user actually grants your app a file, I think it doesn't invalidate the security model to know just that file's absolute path.
I'm wondering if the state of things has changed at all with Flex 4 and there's a method of getting the local filename of anything. I need it because I'm making an application that when distributed runs locally in 99% of cases, so doing a full file upload just to save it somewhere else on the local machine seems silly. (Plus the standard file uploading method doesn't support SOAP, which is what I'm using for all my other services...)
I have been working on Flash AS3 project. I am designing a 3D system. Consider a MovieClip A which is at (0,0,0). A contains B which is at (10,10,10). If I rotate A by 10 degrees then the position of B with respect to A remains the same but position of B with respect to the system changes. To find Global X and Y of B, we have the function localToGlobal but it does not tell anything about the Z property. How to find that?
The question is simple. I need one line command like,Math.round((-Math.random() * 2)),which in output just shows 1 and -1. I try to figure it out but it seems not a easy task! I can use IF command like,demo = (Math.random()>.5)?(1):(-1);
our collaborators misposition the registration points of MCs.Here's the deal: we need to recover the REAL MC's coordinates (not the ones based on registration point). Is it possible? How? I've tried some code already (like getBounds and getRect functions) but all of 'em consider the registration point.
My stage contains an object that contains a child. The child sees it's x and y position in relation to it's parent, so when the object moves, the coordinates remain the same.
How do i get a child's coordinates relative to the stage?
I think I know the answer to this one already, but am looking for any workaround or solution (php??)
I have a AS3 .swf that will be hosted on a client machine running from a web server and viewed in a browser.
It loads a list of images, etc from xml and then displays them. Fine. The problem is, the client wants to be able to put absolute file/network paths in the xml eg: file://filepath or \Serverpathetc....
I have a flash file that is pulling in images from a folder and a .txt for text content. The code for the .txt file:
[Code]...
It cannot find it? What am I missing I can't figure out how to get this to work, and I want absolute paths. I'm sure it's really simple, I just can't figure this out.
I need (convert) absolute position of nested mc (_root.mc.mc._x) on the stage. I noticed that the function localToGlobal could do this, but I could not figure out how. Maybe I could do workaround with counting positions of parent clips, but that sounds lame. how to trace this on the Stage? (trace(_root.mc.mc._x);
i'm in the process of building a movie that is to be loaded and played into another main swf. the targeting (which is multi-level) works fine when the movie is played by itself but when it's loaded and played in the main swf some of the targeting doesn't work. i've tried using _parent. and stuff like that but it's not working. any ideas? can someone point me in the right direction? the frustrating thing is that some of the targeting does work.
I Have a quick question concerning absolute links in flash. I have a Flash gallery that is populated by php and xml. I was using relative URL's in all of my URLLoaders and everything worked fine. But when I moved my source files on to a different server and switched to absolute URLs, I got a 1010 Error. Could this be a flash player security issue?
im trying to embed an swf file in facebook. To cut the story short, the swf im trying to embed is loaded fine but stops at preloader stage (0% of 1) and is not progessing as if it has missing link and couldnt locate something (the files struscture is one main swf file; index.swf loads other 5 swf),But, when i tried to load it up directly from browser, it works fine. I have been advised that changing the link path to absolute between the index.swf and 1.swf, 2.swf etc would solve the problem.
My questions will be:
-how do i change this path, because i couldnt seem to find any link that reflects the connection between those files?
-Is there any feature in flash that would be able to show this link rather than diggin up every symbol?
-If changing the path wouldnt solve the problem, what could be the reason this error is happening?.
How can I get the absolute stage position of an object within a custom flex component that I exported from flash? In my Flex application I'm using the component and resizing it by setting its height and width properties. I want to place another component on the stage but I want it to appear at the same x and y coordinates of a text field in my custom component.