2309 posts
  • Beta Tester
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 6-7 years
  • Referred between 10 and 49 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Sold between 100 and 1 000 dollars
  • United States
theflyingtinman says



... All other solutions for my file failed :(

So just out of curiosity: what do you see if you run:

trace( new LocalConnection().domain );

in an AS3 FLA ?
localhost of course. The methods above when applied to my file just didn’t work :| rondogs is perfect. You’ll see the file in a couple of days tinman :)

Weird. So even though new LocalConnection().domain evaluates to localhost replacing the top two lines of rondog’s solution with …

if ( new LocalConnection().domain == "localhost" )

... doesn’t work? How can it not? (unless there was a problem inside the if/else statement when you tried that.)

4145 posts Community Mod Building awesome stuff for your mobile devices!
  • Community Moderator
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Interviewed on the Envato Notes blog
  • Author had a Free File of the Month
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Tutorial to a Tuts+ Site
  • Won a Competition
+9 more
Enabled Volunteer moderator says

No no no Steve. You got it wrong! the solution from rondog WORKS ! Others don’t. Rondog’s solution is the only one that works! :)

1277 posts
  • Bought between 50 and 99 items
  • Contributed a Tutorial to a Tuts+ Site
  • Exclusive Author
  • Has been a member for 6-7 years
  • Interviewed on the Envato Notes blog
  • Referred between 100 and 199 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
+2 more
rondog says

No no no Steve. You got it wrong! the solution from rondog WORKS ! Others don’t. Rondog’s solution is the only one that works! :)
He is saying this will work as well
if (new LocalConnection().domain == "localhost")
{
    loader.load(new URLRequest(xml));
}
else
{
    loader.load(new URLRequest(xml + "?"+new Date().getTime()));
}

which it does

2309 posts
  • Beta Tester
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 6-7 years
  • Referred between 10 and 49 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Sold between 100 and 1 000 dollars
  • United States
theflyingtinman says


No no no Steve. You got it wrong! the solution from rondog WORKS ! Others don’t. Rondog’s solution is the only one that works! :)
He is saying this will work as well
if (new LocalConnection().domain == "localhost")
{
    loader.load(new URLRequest(xml));
}
else
{
    loader.load(new URLRequest(xml + "?"+new Date().getTime()));
}
which it does

That’s exactly what I mean. I know it works. I (almost) always test any solution I propose before posting them ( I don’t trust my memory :) ). The only possible reason I can think of why might that might not work is if the test is implemented in an external class and LocalConnection class has not been imported:

import flash.net.LocalConnection;

or

import flash.net.*;

but that is an error that would be caught by the compiler.

@Paul: How does it fail? Does the wrong part of the if/else get executed : What does this trace:

if (new LocalConnection().domain == "localhost")
{
    trace("LOCAL")
}
else
{
    trace("NOT LOCAL")
}

or does it execute the correct code but just fail to bust the cache?

4145 posts Community Mod Building awesome stuff for your mobile devices!
  • Community Moderator
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Interviewed on the Envato Notes blog
  • Author had a Free File of the Month
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Tutorial to a Tuts+ Site
  • Won a Competition
+9 more
Enabled Volunteer moderator says

@Steve, it’s not OOP , it’s timeline coded. I’ve coded a number of buttons to interact with a PHP and an XML ( you probably know what I mean, and what my next file will be, i’d rather not go into details on the forum ) , I didn’t want to code it OOP because it’s a series of buttons with code inside of them using (parent as movieclip) to apply settings to them. It’s much easier to use them this way.

Using the method you provided above, it doesn’t execute only one button. No error, no problem. But the script only reacts with one button. Meaning, if I apply the if/else for 7 buttons, it will only work for one. :| I have no idea why it does that. I even tried going with an event to trigger the if / else. It didn’t want to. Then rondog gave his solution. Works like a charm.

It never happened to me before, I even tried inverting the if with the else, doesn’t work online. I thought the scripts were written wrong. All scripts were working properly.

If you want, I can e-mail you my version of the file now and you can have a look for yourself. I’ve already implemented rondog’s system and it works like a charm.

by
by
by
by
by
by