2309 posts
  • Has been part of the Envato Community for over 7 years
  • Has referred 10+ members
  • Has sold $100+ on Envato Market
  • Has been a beta tester for an Envato feature
+5 more
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.)

4569 posts Community Mod Building awesome stuff for your mobile devices!
  • Contributed a blog post
  • Elite Author: Sold more than $75,000 on Envato Market
  • Helps us moderate the forums
  • Has sold $125,000+ on Envato Market
+15 more
Enabled 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
  • Has been part of the Envato Community for over 7 years
  • Has referred 100+ members
  • Has sold $40,000+ on Envato Market
  • Interviewed on an Envato blog
+7 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
  • Has been part of the Envato Community for over 7 years
  • Has referred 10+ members
  • Has sold $100+ on Envato Market
  • Has been a beta tester for an Envato feature
+5 more
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?

4569 posts Community Mod Building awesome stuff for your mobile devices!
  • Contributed a blog post
  • Elite Author: Sold more than $75,000 on Envato Market
  • Helps us moderate the forums
  • Has sold $125,000+ on Envato Market
+15 more
Enabled 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.

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by