Accessing One SharedObject From 2 Swf Files
Hi. I was wondering how i would go about accessing a shared object from two different swf files. do i just declare it in both swfs? do i need to use _root or whatever in one swf and not in the other? Thanks. MJ
KirupaForum > Flash > Flash 8 (and earlier) > Flash MX 2004
Posted on: 03-22-2005, 05:49 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Accessing One SharedObject From 2 Swf Files
Hi. I was wondering how i would go about accessing a shared object from two different swf files. do i just declare it in both swfs? do i need to use _root or whatever in one swf and not in the other?
Thanks.
MJ
Accessing Same Remote SharedObject From Different SWF Files
I am trying to access the same remote SharedObject from two different SWF files.
The separate SWF files are essentially a "presenter" and a "viewer" for a web based slide show. The "presenter" SWF file has the ability to change slides. Once the slide is changed by the "presenter," I use onSync to change all the "viewers."
Right now, I am doing this from within one single SWF file, and just using separate scenes for the "Presenter" and "Viewer," and just using an opening scene where the user logs-in to determine if they are the presenter or just another viewer. I would ideally like to split this up into separate movies (presenter.swf and viewer.swf), but I don't think that SharedObjects can be shared among different SWF files.
I am hoping to either know that they can be (and how) or at least that they cannot be so I won't waste time.
Thank you.
Multiple Movies Accessing 1 SharedObject
Hi,
Ive got quite a nasty situation here and am wondering if anyone else has encountered this problem before and knows of a work around.
I have a mostly HTML page which containing several flash movie components that are all communicating with each other. I am trying to make use of one SharedObject that all the movies read / write and have found that flash isn't allowing it. Basically two flash movies can grab the SharedObject, but only the first one to get it can write to it. Its like there is some kind of locking that is put in place.
So... is there a workaround? Do i have to destroy my instance of the SharedObject when its not in use for another movie to access it?
Thanks in advance,
Billy
[AIR]Saving Files To SharedObject
I am doing a mp3 player like a Winamp
I can get names and urls of droped files.Then I use Sound class to play them. There is no problem.
But when user close my player and open again, the files must be on the list... I thought to use Shared Objects.
This my droped file code:
ActionScript Code:
var file_list:SharedObject = SharedObject.getLocal("files");d = e.clipboard.getData(ClipboardFormats.FILE_LIST_FORMAT) as Array;file_list.data.sounds = d.toString();
You see it is array.No problem here.Then my first codes:
ActionScript Code:
var file_list:SharedObject = SharedObject.getLocal("files");if (file_list.data.sounds!=null) { d=file_list.data.sounds.split(",") trace(d);}
In output:
Code:
[object File],[object File],[object File],[object File]
Yes you think there is no problem.But yes there is I can't get the files names or urls.The error like this:
Quote:
TypeError: Error #1034: Type Coercion failed: cannot convert "[object File]" to flash.filesystem.File.
at deneme0_fla::MainTimeline/baslik_yarat()
at deneme0_fla::MainTimeline/deneme0_fla::frame1()
at runtime::ContentPlayer/loadInitialContent()
at runtime::ContentPlayer/playRawContent()
at runtime::ContentPlayer/playContent()
at runtime::AppRunner/run()
at global/runtime::ADLEntry()
First of all can we save our files? If yes how? Thanks...
Accessing CD Rom Files
Can anyone help with this?
I have a project which was done using Flash MX (Projector). I am planning on using an installer to load this .exe and the larger files (video, animation, etc.)to the hard drive then launch the program. I need the application to also access the smaller files stored on the cd. How do I get access to the CD rom since the drive letter could be different on many computers.
Any help would be greatly appreciated.
lorni
Accessing ASO Files.
I'm working on an auxilary class for collision detection at the moment. Like most precise collision detection methods, it suffers a bit in fps. The approach I'm taking is using ByteArrays, but I think I could speed it up considerably and still have precise detection. Only problem is I need access to an intrinsic class (BitmapData). I don't want to change the class - just retrieve some of the code from one of its methods and add the necessary bits I need in my own class.
From what I've seen when trying to track down the class, it's mostly stored in an ASO file. It's nicely obfuscated, and I'm not terribly interested in going in and cleaning it up by hand so I can work with it. Does anyone know of a relatively painless way of working w/ these files?
EDIT - Disregard. I've worked out code of my own that takes a different approach from what I originally planned on doing. Happy to say it works rather efficiently, and I won't be needing access to the intrinsic Adobe classes.
Help Accessing Cd Files
I have a project that is accessing files from a cd. iam using the get url action i.e.
on (press) {getURL ("files/xxx.pdf","_blank");}
when i try to access the files from the cd i created it will not open them unless i have a browser open already, if not it just hangs.
Anyone encountered this one before. If so, please advise.
Thanks in advance
Visual1
("The only difference between me and a madman, is that I am not mad") Dali
Accessing Variables From Txt.files?
I cant seem to use the variable that I get from my txt file. The right number from the txt is being placed in the textfield where I want to store it but when I try and transfer that variable I have no luck.
// this line gets the right number and transfers it into a text field called totalRiders
loadVariables("numberOfRiders.txt", "");
//this is where the problem occurs. It wont let me transfer the number from totalRiders into the test text field.
test = totalRiders;
Please help me. Its driving me crazy.
Accessing Metadata From Mp3 Files
hello guys!... i was using the id3 property and well i want to get the genre after it loads the mp3 but it just returns a number, instead of returning say Rap it returns 15, is there any list associated with this?... any ideas?
Accessing Text Files
I am writing an swf to run on my computer (perhaps as an exe, I am not sure yet). Is it possible to create and access text files using actionscript?
I plan to use LoadVars to get information from a mySQL database (through a php file on my site) and then store this information in a text file (with "|" separating fields and "||" separating lines);
So, really, all I need to know how to do is create a text file that stores 1 variable.
Thnx
Accessing Functions In .fla From .as Files
I was wondering if there is a way to access functions and variables that are defined in .fla, on some scene/layer´s actions, from a custom made class.
for example, if i have a variable var object:Array() defined in Scene 1--Layer
how can i access this variable from custom class .as file.
Accessing Files Outside Of Web Root
Is there a way to load a file, specifically audio, from outside of the root web directory? I have audio files placed outside the root so that they cannot be directly accessed through a Web browser. Can Flash do this, or is there a way to use PHP to feed the file into Flash?
Thanks.
PLS Help : Accessing Text Files With FLash MX
Pls do help me. URGENT
I have created a movie in flash mx n i have to store some variables in a text file on my harddisk. The movie is to b run from my hard disk n the flash movie is to check if file, VARIABLES.TXT exist in a particular directory (creating the file if doesn't exist) n then stores the values there. Can anyone pls do help me out. Thanks dudes!
Accessing Files Locally Via Actionscript
I have a flash nav bar, and im trying to get the links to target files on a local HD with getURL. any suggestions?
ActionScript Code:
on (release) {
getURL("**/VH1.htm","mainFrame");
Accessing Local Files From Server Swf
Hi,
I have a swf in a server call layers.swf. This swf is called from a local html page (in the object tag). In the same directory than the local html page, there's a folder containing several images. The remote swf tries to access these images using the path -for instance- 'img/image1.jpg', but unfortunatelly, the swf does not load these images due to a security issue (i think). Has anybody know what could be happen or how to solve it?
Thanks in advance,
Fernando
Accessing Functions In Embedded AS Files.
Hi,
I created a ChatLoader.swf that first imports Connect(); for the connect functions and then imports Avatars(); for the avatar functions.
the Avatars.as has several functions that need to transmit variables to Connect.as so that it sends the variables across to other people. How can i get Avatar.as to acces the Connect functions?
I can't import Connect.as into Avatar.as since it'll create 2 connections with the server.
ChatLoader.swf itself has
Code:
private var connect:Connect= new Connect();
and Connect.as has
Code:
public function write(str:String):void
{
socket.writeUTFBytes(str);
socket.flush();
}
so that i can write:
Code:
connect.write();
from the ChatLoader.as if i want to send variables to the connect functions. I'd like to do the same with the avatar functions but it doesn't seem to work.
Accessing Local Files(.mp3s)?
I've always been a constant visitor to gotoandlearn since i can remember, and i got excited when i saw the new features on as3 (in cs4) to be able to access local files. I tried this tutorial with success, but i then again tried it with .mp3 files, but couldn't get it to work. The ability to be able to do this is integral to my new game, and i really need to able to access local mp3s in the browser (preferably using the browse function). I can do this with cs3, but only in the external flash player, if i open the same file in firefox, i can't open the .mp3
If anyone can help me, i'll give them any credit they want, and possibly part of the sponsorship money.
Thanks in advance.
Accessing Local Text Files In Flash
I have a flash document that imports some variables from a text file in the same directory as the flash document. The problem is that it only loads the variables in certain circumstances.
If you try to access the flash document directly, everything is fine. The table @ the botton is the one dynamically populated from the text file variables:
http://www.bostonbloggers.com/problem.swf
same thing with an html file, on the same server, that contains an embed tag for it:
http://www.bostonbloggers.com/problem.html
The problem is when I try to embed the flash document into an html file on another server:
http://24.61.212.36:8080/Test/problem.html
I can't figure out what could be doing this. Any ideas?
Accessing The Same Array From Stage And Class Files?
Hey all.
Ive been stuck on this for a while now, and am finding it hard to find anything on the net, because whenever i combine "array" and "class(es)" in a search it just brings stuff up about the array class lol.
What i basically want is:
enemies are created on the main timeline via actionscript, and pushed into an array.
How can i now access that array from within say a "Turret.as" class file that is controlling my turrets, to let them loop through the enemies and choose their target?
Thanks for any help,
Gareth
Projector File Accessing The Net And Local Files
Hi all,
I've been looking everywhere for the last week for a solution to this and haven't found one yet.
The short version:
I have a projector file that has a simple call
Code:
loadMovieNum("http://www.mysite.com/opener.swf", 0);
It appears to work fine until I try to load a swf file (located on our sever) into a Loader component. It's not that I can't access the internet because other files are pulled in. I do use other components though, so it's not that I am not loading that component.
The long version:
Our company has a product that is used in school computer labs. If we have 25 kids trying to access the internet to get our FLVs it would choke their T1 line. So we decided to put the FLVs locally on thier hard drives and have them still access the smaller swf files from the internet in case we need to update them. It worked great with Flash Player 8. But now FP9 restricts ANY network swf from accessing the local drive because of it's new security settings. So I decided to make it a projector file that would call in the original opener swf. Since the projector ignores the security rules. But I still can't access the hard drive files (FLVs), nor files (SWF) that re displayed through a Loader Component.
I know it's a long read but I really need some help.
Thanks,
Rolando
Check us out
www.geeguides.com
I Have A Problem In Accessing External SWF Files Tab Index.
Hi Friends,
I have a problem in accessing external SWF files tab index.
I tried to access the external SWF’s buttons by the Local Connection. I tried to give the tab index for the external SWF file. I am accessing more than two external SWF files. The tab index for the external SWF file’s Buttons are assigned, but they are not working properly.
Can somebody review my code given below and help me to resolve this issue? Thanks a ton in advance.
This is the main File Receiving the connection from the external SWF File:
var connSample:LocalConnection;
connSample = new LocalConnection();
connSample.client = this;
try {
connSample.connect("sampleConnection ");
} catch (error:ArgumentError) {
------------
This is the External SWF file:
var connSample:LocalConnection;
connSample = new LocalConnection();
button1_btn.addEventListener(MouseEvent.CLICK, btnClick);
function btnClick(sampleEvent:MouseEvent)
{
connSample= new LocalConnection();
connSample.send("sampleConnection", "sampleName", sampleEvent.currentTarget.name);
}
Netscape Browser Not Seeing Shared Object Or Accessing C:/Program Files
HI
I have a password protected file (swf inside an html) that uses a shared object. It works great on IE but not on Netscape.
Can anyone help?
I tried also on Mozilla firefox and it picks up the shared object but reduces all my swf files int he html down to a very small size (even thou I put 100% in the HTML code width/height!!).
I am about to try on Opera and then the mozilla ordinary version in a mo and hoped that it is a simple html issue but thinking its more than that for the shared object side of things....
can anybody shine any light on any of these?
ta.
Shaf.
[CS3] SharedObject Being Set In Swf A, Check SharedObject In Swf B
Hi guys,
I haven't done any real work with sharedObjects so forgive me if the answer is obvious.
I am setting a SharedObject in swf 'A' if and i want to check it is set in swf 'B'
Both swf's are in the same folder space.
I have been messing with it the past couple of days but i cant get it to read what is set in swf 'A'.
am i able to read in swf 'B' what was set in swf 'A'?
Thanks
SharedObject Being Set In Swf A, Check SharedObject In Swf B
Hi guys,
I haven't done any real work with sharedObjects so forgive me if the answer is obvious.
I am setting a SharedObject in swf 'A' if and i want to check it is set in swf 'B'
Both swf's are in the same folder space.
I have been messing with it the past couple of days but i cant get it to read what is set in swf 'A'.
i am able to read in swf 'B' what was set in swf 'A'?
Thanks
SharedObject Being Set In Swf A, Check SharedObject In Swf B
Hi guys,
I haven't done any real work with sharedObjects so forgive me if the answer is obvious.
I am setting a SharedObject in swf 'A' if and i want to check it is set in swf 'B'
Both swf's are in the same folder space.
I have been messing with it the past couple of days but i cant get it to read what is set in swf 'A'.
am i able to read in swf 'B' what was set in swf 'A'?
Thanks
SharedObject Being Set In Swf A, Check SharedObject In Swf B
Hi guys,
I haven't done any real work with sharedObjects so forgive me if the answer is obvious.
I am setting a SharedObject in swf 'A' if and i want to check it is set in swf 'B'
Both swf's are in the same folder space.
I have been messing with it the past couple of days but i cant get it to read what is set in swf 'A'.
am i able to read in swf 'B' what was set in swf 'A'?
Thanks
Tough One: Accessing Class Methodes From Other Class Files
Tough question for the experts...
In my classfile class Classes.tools.depthManager, I've got a static methode
Code:
public static function getLoopDepth():Number {
In another classfile Classes.tools.frameRateViewer, I want to access that methode
Code:
var tempDepth = Classes.tools.depthManager.getLoopDepth();
The compiler claims: "There is no class or package with the name 'Classes.tools.depthManager' found in package 'Classes.tools'."
So I tried writing import Classes.tools.* at the top of my Classes.tools.frameRateViewer.as, hoping I could just write
Code:
var tempDepth =depthManager.getLoopDepth();
But there the compiler claims: "The class being compiled, 'Classes.tools.depthManager', does not match the class that was imported, 'depthManager'."
I'm sure the Classes.tools.depthManager.as works fine: I can call the static depthManager.getLoopDepth() from a button in the fla file...
Any ideas? Thanks!
Accessing Files/folders Inside Other Application Folders
How can I have an asc file from one application read text files in another applications directory?
I have multiple applications creating text files stored in a directory called docvid (this is my application directory). I also have another completely different application that needs to access these text file. How do I use the "sandbox" stuff to allow this other application to read these text files?
This code works fine:
custEmail = new File("/streams/"+userName+"/"+"email.txt");
but this doesn't
custEmail = new File("../email.txt");
It says:File operation open failed.
Importing Files/ Opening Files In Files/ Adding Files Into Scenes.
Alright Here is the deal.
I got some movies, which are seperate FLA. files, and I want to eventually add all these 4 seperate files, into scenes in one main FLA. file. How do I do this so that I have the symbols ect. I am pretty sure you can't just copy/paste.
Which FLASH** guru out there can lead me in the right direction?
greatly appreciated...
*g.guru.
SharedObject?
Okay, I was checking out a new developer tutorial on macromedia.com when the author says:
"Although we'll cover the basics of reading from and writing to a SharedObject, much more information is available under the SharedObject entry in the ActionScript Dictionary (Help > ActionScript Dictionary)."
I can't find an entry for sharedobject anywhere. What's more is that it's not listed in the actionscript windows within flash. The author laters gives an example of use:
"so = SharedObject.getLocal("myInfo");"
But still I can't seem to find any references to SharedObject OR getLocal.
Anyone want to give me a push in the right direction?
Skex
Different Use For SharedObject?
I have a Flash website with a map and users can create new icons on it on the fly (using attachMovie). Changes made by any users must be visible to all visitors. People had advised me to use SharedObject but...
For SharedObject, it seems that every users can only save and see their own changes because SharedObject is stored locally. Is there a way to only use one SharedObject stored in the server? Or another way to put it is can every user who visit my website use the same SharedObject?
Thanks!
Help With Sharedobject
Hi,
I am using sharedobject to store information of flash movies.
mydata = sharedobject.getlocal("database")
somevariable = mydata.data["somevariable"]
All these movies are separate swf that are part of a course.
I need to make a function that exports and imports data from all movies but I haven't figured out how to access info from a different movie, only from the movie currently loaded.
Is this possible? con variables be stored by a.swf and then accessed by b.swf?
Thanks for your help.
SharedObject
Hello,
I have a simple animation that I don't want played after a return visit. It's boggling my mind.
Code:
stop();
so = SharedObject.getlocal("testing", "/");
if (so.data.Visited) {
gotoAndPlay("end");
} else {
so.data.Visited = true;
so.flush();
play();
}
This works great locally testing movie, but does not work on the server. Am I missing something here? Any help would be greatly appreciated.
SharedObject - Where ?
I make a Flash Windows projector where I use a sharedobject to save the data of the user. I want the user be able to save (on a disket for example) the sharedobject file .sol. So I want to automatically show to the user the place where is this file, like:
CWindowsapplication datamacromediaflash player...
Is there a way to display this link ?
Thank's
Michel
SharedObject Help?
I'm trying to get a better understanding of sharedobjects. I understand its like a "cookie" but where is the information being stored on the persons computer?
Sharedobject
I am starting a sharedobject,
myLocalSO = sharedobject.getLocal("flashcookie16" );
How do i clear all the information?
There is flush(); does that save info or kill the cookie?
is there a kill sharedobject function? so you can keep the object but set everything in it to default or the begining.
Sharedobject
why does this script say my sharedobject (myLocalSO) is undefined?
I clearly set it as "flashcookie15"?
this is nuts.
stop();
myLocalSO = sharedobject.getLocal("flashcookie15" );
trace(myLocalSO.data.counter); //indefined????????
if (myLocalSO.data.counter > 1) {
numVisits.text = "You have been here " + myLocalSO.data.counter + " times."
gotoAndStop(4);
}else {
Play();
myLocalSO.data.counter = 1;
}
myLocalSO.data.counter++;
SharedObject
Where is the folder on the local machine stored.
if you test this through flash not through a browser.
thanks.
Help With SharedObject
I have script to check reminder.cfm for text and if found, start the movie. What I want is once a user has seen the movie that it would not play again until the next day?
I have been using SharedObject but I jest cant get it to work.
e.g.
I have a text field on the scene Dynamic Text ,Instance name:txtName
Script also in frame 1:
myOjbect = SharedObject.getLocal("test");
myObject.data.myName = "Mark";
myObject.flush();
myOjbect = SharedObject.getLocal("test");
txtName.text=data.myName
But when I "test movie" it return "undefined" in the text box.
Sharedobject
where is the file stored that the shared object creates?
SharedObject, How?
Hi, I am trying to use the SharedObject, but I do not obtain, he is following, I have this menu, and when I click in some item and to call the next page, it he has that to continue with the selected menu, I do not obtain to make this, it always comes back to the normal one, I tried to read in help of the flash, but I did not understand.
SharedObject Help
Trying to set up a shared object for storing a language choice variable. I thought the following code should save a test.sol file to my hard drive, but I can find no such file. The trace(myObject.data.language); returns undefined. Can some one tell me what I'm missing?
Code:
var langSel = "en";
var myObject:SharedObject = SharedObject.getLocal("test");
myObject.data.language = langSel;
trace(myObject.data.language);
trace(langSel);
ps - Can some one also please tell me, and I feel pretty stupid asking because it's probably right in front of my face, how do you post your code with actionscript formating (not PHP or CODE as I have used)?
SharedObject From Swf To Swf
happy new year!
I have two swf's in the same domain.
one writes a user's preferences, and the other should pick them up.
trouble is, the one that should pick them up, doesn't.
this code writes the SharedObject:
PHP Code:
user_details = SharedObject.getLocal('avdetails_djcobblers');
user_details.data._me = prefs;
user_details.flush();
and this code in a different swf from the same domain should pick it up, shouldn't it?
PHP Code:
user_details = SharedObject.getLocal('avdetails_djcobblers');
details = user_details.data._me;
trace( "user_details._me=" + details);
But it doesn't, the trace returns a blank. But I don't know why.
Maybe someone out there does, please?
SharedObject Help
Hi all,
I am currently working on a cd-rom presentation, where on autorun
load up i have an .exe that pops up that is a form that writes to the
users default email client (outlook...etc).
My question is .... Can i use some script, I have been reading up on
the sharedObject stuff, that will recognise that the end user has
played the CD-rom before and thus the CD-rom will skip launching the
form.exe and just go to the main presentation.
Any help, advice, or "luke your a fool for trying this!!!" would be
great.
cheers
luke
SharedObject
I have been reading a chapter about creating a SharedObject, and the author says, "When the SWF session ends...all the information under the data property of your shared object is automatically written to the shared object file ready to be retrieved usitng the getLocal() method..."
The example given is:
var myObject:SharedObject=SharedObject.getLocal("file_ name");
To save to the object you write:
myObject.data.userName=userName_txt.text;
I have followed the example verbatim, but notice that when I exit the .swf and re-open it, the information that I wanted to save did not save. The author mentions myObject.flush(); to "force" the object to be written, but I would like to have this happen upon exit rather than asking the user to click a button or the like. Am I missing something?
Thanks in advance -
Sharedobject
im using shared object to save some input text for each time i open a file - i need to use several shared objects in one file, how do i do this?
|