Display variable from file WITHOUT EDITING IT

  • Wintallo
  • Born
  • Born
  • Wintallo
  • Posts: 1

Post 3+ Months Ago

Hey,

I was wondering how (or if it's possible) to display a variable declared in a separate swf file. eg. I have a game with a highscore variable called _level0.punteggio and I wan't to display that variable in a different flash file. I don't want to have to edit the original flash file with the variable I want to display. You see, I can't legally edit a .swf file that isn't mine and that I don't have permission to edit (and can't get permission for). I need a way to create a flash file that will call that certain variable I told you about and be able to do something with the variable without editing the file that holds it. Please, if you know anything about this, I encourage you to post a reply or even email me at ryanetjoel(at)wintallo(dot)com. If you don't know, ask someone else for me because chances are that any one of you knows way more people who know about actionscript than I do.

Ryan et Joel
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

in your flash movie, in a key frame frame from the timeline (make it frame 2):
Code: [ Select ]
this.createEmptyMovieClip("swfHolder", 0);
swfHolder.loadMovie("somefile.swf");

onEnterFrame = function()
{
  if (swfHolder.getBytesLoaded() >= swfHolder.getBytesTotal())
  {
   delete onEnterFrame;
   gotoAndPlay(3);
  }
}
stop();

// in frame 3:
trace(swfHolder.punteggio);
stop();
  1. this.createEmptyMovieClip("swfHolder", 0);
  2. swfHolder.loadMovie("somefile.swf");
  3. onEnterFrame = function()
  4. {
  5.   if (swfHolder.getBytesLoaded() >= swfHolder.getBytesTotal())
  6.   {
  7.    delete onEnterFrame;
  8.    gotoAndPlay(3);
  9.   }
  10. }
  11. stop();
  12. // in frame 3:
  13. trace(swfHolder.punteggio);
  14. stop();

so, the basic idea is: you load the swf in your own movie clip, then you use
movieClipName.variableName to access the data from the loaded swf.

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 14 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.