Re: [Flashcoders] Funny, Code Worked Before...

2010-05-28 Thread John Singleton

Ok, I've nailed down where the problem is as to why my silly little *.as file 
that worked so well before won't work with minor changes in my latest *.as 
file. The problem appears to be that Flash freaks out over different image 
files! Here's the code, simplified:

package 
{
import flash.display.Sprite;
import flash.text.TextLineMetrics;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.TextFormatAlign;
import flash.text.TextFieldAutoSize;
import flash.net.navigateToURL;
import flash.display.Bitmap;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.display.MovieClip;
import com.greensock.*;
import com.greensock.easing.*;
import flash.display.Loader;
import flash.events.ProgressEvent;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.TextFieldAutoSize;
import flash.net.URLRequest;

[SWF(backgroundColor=0x565656)]

public class DeJonghPreloader extends MovieClip
{
var loader:Loader = new Loader();
private var myTextField:TextField = new TextField();
var imgFlag1:Boolean = new Boolean(false);

public function DeJonghPreloader()
{
addEventListener(Event.ADDED_TO_STAGE, init, false, 0, true);
}

private function init(e:Event)
{
var clientName:TextField = new TextField();
var format:TextFormat = new TextFormat();
format.font = 'Arial';
format.size = 35;
clientName.textColor = 0x023048;
clientName.text = 'Delta Electric';
clientName.autoSize = TextFieldAutoSize.LEFT;
clientName.setTextFormat(format);
var nameSprite:Sprite = new Sprite();
nameSprite.x = stage.stageWidth/2 - 70;
nameSprite.y = stage.stageHeight/2 - 40;
nameSprite.alpha = 0;
TweenLite.to(nameSprite, 2, {alpha:1});
addChild(nameSprite);
nameSprite.addChild(clientName);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, 
imageLoaded);
loader.load(new URLRequest(images/charles.jpg));
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, 
loop);
removeEventListener(Event.ADDED_TO_STAGE, init);
addChild(myTextField);
myTextField.width = 250;
myTextField.x = stage.stageWidth/2;
myTextField.y = stage.stageHeight/2;
myTextField.selectable = false;
myTextField.border = false;
myTextField.borderColor = 0xAA;
myTextField.autoSize = TextFieldAutoSize.LEFT;
var myFormat:TextFormat = new TextFormat();
myFormat.color = 0x023048;
myFormat.size = 24;
myFormat.italic = true;
myTextField.defaultTextFormat = myFormat;
}

private function imageLoaded(event:Event):void
{
imgFlag1 = true;
completePreloader();
}

function completePreloader()
{
var req:URLRequest = new URLRequest('index.py');
navigateToURL(req, '_self');
}

function loop(e:ProgressEvent):void
{
var perc:Number = e.bytesLoaded/e.bytesTotal;
myTextField.text = Math.ceil(perc*100).toString() + %;
}
}
}

Now, that code works just fine. However, if I change the image from 
charles.jpg to left1.png it doesn't work. What breaks? Who knows? If I put 
a trace in completePreloader(), it traces, so one would thing that the 
URLRequest works, right? Wrong. The page is never sought, witnessed by the fact 
that, if charles.jpg is in, an error is traced on my Mac when trying to find 
the relative address, but if left1.png is in, no error. Now, it doesn't 
matter if it's a png or a jpg, because the original file that works has a 
couple pngs as well. I've gone so far as to copy and rename the working files 
in the same directory as the originals, prove they work, copy over my images 
and change them and watch this code break. So it _is_ the images that are 
causing the problem. But why, o why???
John



  

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] Funny, Code Worked Before...

2010-05-27 Thread John Singleton
Hi;
I have this code:

function completePreloader()
{
navigateToURL(new URLRequest('index.py'));
trace('yep');
}

that is triggered after all the assets have loaded in the preloader. It prints 
the trace. But it doesn't surf to the URL. It just sits there. Also, when I run 
the other code that works, which is basically identical, it prints this error:

Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.

because it can't surf to that relative URL. But my new *.as file doesn't print 
that error. Why?
TIA,
John



  

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Funny, Code Worked Before...

2010-05-27 Thread Matt S.
does it work differently locally vs when uploaded to the server?

.m

On Thu, May 27, 2010 at 10:43 AM, John Singleton
johnsingleton...@yahoo.com wrote:
 Hi;
 I have this code:

        function completePreloader()
        {
            navigateToURL(new URLRequest('index.py'));
            trace('yep');
        }

 that is triggered after all the assets have loaded in the preloader. It 
 prints the trace. But it doesn't surf to the URL. It just sits there. Also, 
 when I run the other code that works, which is basically identical, it prints 
 this error:

 Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.

 because it can't surf to that relative URL. But my new *.as file doesn't 
 print that error. Why?
 TIA,
 John





 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Funny, Code Worked Before...

2010-05-27 Thread Deepanjan Das
Hi John,
No in this case no need to pass the Event.

Try classifying the SWF file as local-with-networking or trusted.

Check for allowScriptAccess=always in the containing document.

You will not be able to navigate the windows _self, _top, or _parent
if the SWF file is contained by an HTML page that has set the
allowScriptAccess to none, or to sameDomain when the domains of the HTML
file and the SWF file do not match.

Check all of these

Cheers
Deepanjan Das

On Thu, May 27, 2010 at 8:38 PM, John Singleton
johnsingleton...@yahoo.comwrote:

 From: Deepanjan Das deepanjan@gmail.com
 
 To: Flash Coders List flashcoders@chattyfig.figleaf.com
 Cc: johnsingleton...@yahoo.com
 Sent: Thu, May 27, 2010 10:57:38 AM
 Subject: Re: [Flashcoders] Funny, Code Worked Before...
 
 Just a guess as I am not aware of the whole picture:
 try this -
 
  function completePreloader(e:Event)
 

 Well, I tried that, but what argument am I supposed to pass? Again, this
 doesn't seem to be on track, because this same code works fine with another
 *.as file. All I've done is changed this:

private function imageLoaded9(event:Event):void
{
imgFlag9 = true;
if (imgFlag1 == true  imgFlag2 == true  imgFlag3 == true 
 imgFlag4 == true  imgFlag5 == true  imgFlag6 == true  imgFlag7 == true
  imgFlag8 == true  imgFlag9 == true)
{
completePreloader();
}
trace('9');
}

 which is called after each image is loaded (in this case the 9th). When all
 the images load, then completePreloader() is called, and it gets called
 because the trace in the same prints. But for some reason this:

navigateToURL(new URLRequest('index.py'));

 never gets called. Why??
 TIA,
 John

 
 as you call this on an event.
 
 Let me know. Also check if your debugger is on.
 
 
 On Thu, May 27, 2010 at 8:13 PM, John Singleton 
 johnsingleton...@yahoo.com wrote:
 
 Hi;
 I have this code:
 
 function completePreloader()
 {
 navigateToURL(new URLRequest('index.py'));
 trace('yep');
 }
 
 that is triggered after all the assets have loaded in the preloader. It
 prints the trace. But it doesn't surf to the URL. It just sits there. Also,
 when I run the other code that works, which is basically identical, it
 prints this error:
 
 Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.
 
 because it can't surf to that relative URL. But my new *.as file
 doesn't print that error. Why?
 TIA,
 John
 
 
 
 
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 
 
 --
 Warm Regards
 Deepanjan Das
 M: +91 9836582808
 
 Think of the environment before printing this email
 







-- 
Warm Regards
Deepanjan Das
M: +91 9836582808

Think of the environment before printing this email
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] Funny, Code Worked Before...

2010-05-27 Thread John Singleton
 From: John Singleton johnsingleton...@yahoo.com

 To: Deepanjan Das deepanjan@gmail.com
 Sent: Thu, May 27, 2010 1:03:10 PM
 Subject: Re: [Flashcoders] Funny, Code Worked Before...
 
 From: Deepanjan Das 
 href=mailto:deepanjan@gmail.com;deepanjan@gmail.com
To: 
 John Singleton 
 href=mailto:johnsingleton...@yahoo.com;johnsingleton...@yahoo.com; 
 ymailto=mailto:flashcoders@chattyfig.figleaf.com; 
 href=mailto:flashcoders@chattyfig.figleaf.com;flashcoders@chattyfig.figleaf.com
Sent: 
 Thu, May 27, 2010 11:22:51 AM
Subject: Re: [Flashcoders] Funny, Code 
 Worked Before...

Hi John,
No in this case no need to pass 
 the Event.

Try classifying the SWF file as local-with-networking 
 or trusted.

Do I really need to go to that length? I have another script 
without that that works fine. When I run said script on my Mac Pro, since it 
can't find the relative URL, it throws an error, that the script in question 
here doesn't throw. If I need to do this, can you suggest how to do 
this?


Check for allowScriptAccess=always in the containing 
 document.

I changed it to no avail :(
TIA,
John


  

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders