Re: [Flashcoders] Re: swf doesn't work the same online

2010-03-11 Thread Glen Pike



If I were to rewrite my code in pure HTML (which it isn't, just translates for 
the browser) and do as you say, it would pop up almost immediately because it's 
all right here on a screaming fast Mac Pro.

It struck me at this point, after already trying LiveHTTPHeaders, which is 
pretty darn cool, that maybe the problem I'm running into is caused by not 
being able to get my swf files to load in my newly downloaded FireFox, 
Apparently, Flash doesn't come bundled (amazing). I tried downloading and 
installing it from Adobe, three times, and it doesn't want to install. It isn't 
trying to install like other plugins. So I went to install Charles and 
unfortunately it assumed I wanted to install it in FF not in Safari. So I'm 
back to square one. How do I get FF to cooperate?


  
Aahh, the dreaded Adobe Download Manager -  it worked for me just now on 
FF 3.5.8, but broke before.
I can't remember how I worked around that, but it was a grand PITA and a 
big PITY that Adobe introduced it, the old Flash download worked 
perfectly & seamlessly for me in all my browsers - if it ain't broke 
Adobe, don't break it, concentrate on the FP bugs ;)


You can search for "archived players" and download all of the FP 10 ones 
(157MB!) if you are completely stuck - install them for FF manually, not 
sure if that's the same for MacOS, sorry.

I can't find anywhere where it downloads the swf. I didn't find the words "NOT 
MODIFIED" anywhere. Pity I can't copy and paste then search the output :(
Thanks,
John
  

The NOT MODIFIED is just one possible status returned by the server:
For a successful request you would normally see:
"HTTP/1.1 200 OK"  Which means that your file was found and sent.

You can right click (in Windows) the "Captured" output in the Headers 
tab, select all and choose copy if you need it - you only need to look 
at the request and response for your actual swf files.


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


Re: [Flashcoders] Re: swf doesn't work the same online

2010-03-11 Thread Valentin Schmidt
John Singleton wrote:
> From: Glen Pike  To: Flash Coders List
>  Sent: Thu, March 11, 2010
> 10:45:38 AM Subject: Re: [Flashcoders] Re: swf doesn't work the same
> online
> 
> 
> Let's see if my changes to Yahoo options translate this to plain text
> now ;)

so why didn't you activate the automatic quote settings in yahoo mail,
as I had shown you?

again, this is what correct quoting looks like, and yahoo can very well
do this for you, if you only change those settings accordingly:
http://mailformat.dan.info/quoting/
http://en.wikipedia.org/wiki/Usenet_quoting
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Re: swf doesn't work the same online

2010-03-11 Thread John Singleton
From: Glen Pike 
To: Flash Coders List 
Sent: Thu, March 11, 2010 10:45:38 AM
Subject: Re: [Flashcoders] Re: swf doesn't work the same online


Let's see if my changes to Yahoo options translate this to plain text now ;)

  
I am guessing that your browser caching is turned off and that you are testing 
in the browser, not the IDE?


Browser caching is not turned off, no. Yes, I am testing in the browser not the 
IDE.



What happens if you try "Work Offline"?


If I were to rewrite my code in pure HTML (which it isn't, just translates for 
the browser) and do as you say, it would pop up almost immediately because it's 
all right here on a screaming fast Mac Pro.

It struck me at this point, after already trying LiveHTTPHeaders, which is 
pretty darn cool, that maybe the problem I'm running into is caused by not 
being able to get my swf files to load in my newly downloaded FireFox, 
Apparently, Flash doesn't come bundled (amazing). I tried downloading and 
installing it from Adobe, three times, and it doesn't want to install. It isn't 
trying to install like other plugins. So I went to install Charles and 
unfortunately it assumed I wanted to install it in FF not in Safari. So I'm 
back to square one. How do I get FF to cooperate?



Are you able to look at the actual cache on your computer to see if they are 
there?


Yes, they're there, even though I can't display them. Then I clean them out.


If you are using Firefox, can you use something like the LiveHTTPHeaders add on 
to see the request for the SWF and whether the server sends back "NOT 
MODIFIED". 


I can't find anywhere where it downloads the swf. I didn't find the words "NOT 
MODIFIED" anywhere. Pity I can't copy and paste then search the output :(
Thanks,
John


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


Re: [Flashcoders] Re: swf doesn't work the same online

2010-03-11 Thread Valentin Schmidt
Glen Pike wrote:
> Each to their own I guess, Firebug for me is too much like using a 
> sledgehammer to crack a nut for Flash applications - it's unwieldy and I 
> have found it to be a bigger memory hog than Adobe products. 

who cares? of course you only activate it when you really need it - and
I'm quite sure that in deactivated state it doesn't consume any xtra memory.

I do a lot of PHP/XHTML/CSS/JS/Ajax stuff, and I defintely couldn't live
(well: work) without firebug, no way :-)

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


Re: [Flashcoders] Re: swf doesn't work the same online

2010-03-11 Thread Glen Pike
Each to their own I guess, Firebug for me is too much like using a 
sledgehammer to crack a nut for Flash applications - it's unwieldy and I 
have found it to be a bigger memory hog than Adobe products.  
I have found it vaguely useful for debugging / learning AJAX coding, but 
I still find Charles much more useful and I never use it for HTML / CSS 
- half the time I don't want to inspect my variables, but then I tend 
not to do any heavyweight AJAX.  I guess I am a bit long in the tooth 
for using Firebug for developing web-code, I never saw the point of 
inspecting my CSS when I can do that in the editor and find it much 
quicker to change the colour of a div and resize than try and tweak it 
in the debugger.  I think it's because I am used to writing my own JS 
that I did not use the debugger much - I am not looking at other 
people's libraries so tend to know where I am in the code and what is 
not working.  If I was to go back to doing HTML stuff now I might change 
my mind, but I am trying to avoid it because I hate doing websites 
nearly as much as I hate Steve Jobs.


Valentin Schmidt wrote:

or the "Firebug" addon (which IMHO every web developper should have
installee in his firefox anyway), in the Network Tab in can also show
you the exact details of all HTTP transactions, of course also those
started by the flash (or director shockwave) plugin.
  

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


Re: [Flashcoders] Re: swf doesn't work the same online

2010-03-11 Thread Valentin Schmidt
> If you are using Firefox, can you use something like the
> LiveHTTPHeaders add on to see the request for the SWF and whether the
> server sends back "NOT MODIFIED".

or the "Firebug" addon (which IMHO every web developper should have
installee in his firefox anyway), in the Network Tab in can also show
you the exact details of all HTTP transactions, of course also those
started by the flash (or director shockwave) plugin.

concerning cache, in firefox you can use those 2 about-URLs to get
detailed infos about all cache entries, including last update and total
number of fetches:

about:cache?device=memory
about:cache?device=disk

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


Re: [Flashcoders] Re: swf doesn't work the same online

2010-03-11 Thread Valentin Schmidt
John Singleton wrote:
> From: Valentin Schmidt  To: Flash Coders List
>  Sent: Tue, March 9, 2010 3:28:52
> PM Subject: Re: [Flashcoders] Re: swf doesn't work the same online
> 
> 
>  first, your emails are a bit hard to read, I'd suggest to
> quote correctly (see e.g. http://mailformat.dan.info/quoting/), or
> better, use an email client that takes care of correct quoting (and
> configure it accordingly). 
> 
> I don't see that yahoo affords me the opportunity to do other than I
> have done above. Bummer ;(

in case this is "Yahoo! Mail":
go to Options->Mail Options
at the bottom you will see a checkbox:

"When replying & forwarding: Mark original message with > (plain text only)"

activate it and save the changes (and only use plain text mails for
mailing lists, of course).

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


Re: [Flashcoders] Re: swf doesn't work the same online

2010-03-11 Thread Glen Pike

John Singleton wrote:

Now, the problem is that, for some reason, the "preloader" always, without 
fail, loads the graphics. It never seems to check if these graphics were cached, even 
though they were in fact cached in the browser. I wonder if the reason it doesn't check 
could be because I don't add the graphics to the stage (addChild), since I don't want 
them to appear on stage.

  
I am guessing that your browser caching is turned off and that you are 
testing in the browser, not the IDE?


What happens if you try "Work Offline"?

Are you able to look at the actual cache on your computer to see if they 
are there?


If you are using Firefox, can you use something like the LiveHTTPHeaders 
add on to see the request for the SWF and whether the server sends back 
"NOT MODIFIED". 

You could also look at Charles the debugging proxy, or ServiceCapture by 
Kevin Langdon.

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


Re: [Flashcoders] Re: swf doesn't work the same online

2010-03-11 Thread John Singleton
From: Valentin Schmidt 
To: Flash Coders List 
Sent: Tue, March 9, 2010 3:28:52 PM
Subject: Re: [Flashcoders] Re: swf doesn't work the same online



first, your emails are a bit hard to read, I'd suggest to quote
correctly (see e.g. http://mailformat.dan.info/quoting/), or better, use
an email client that takes care of correct quoting (and configure it
accordingly).


I don't see that yahoo affords me the opportunity to do other than I have done 
above. Bummer ;(


second, I have the impression that this thread could go on forever
without getting anywhere. Maybe it would be a good idea to do a fresh
start, and this time first create a clear conception of what you want to
achieve (in each function), e.g. by describing it in plain english,
before writing your actual code?


OK. I have:
1) Created a "preloader" which preloads two graphics, one of which is rather 
large.
2) These graphics, in turn, are used as assets in two swf files.
3) The first of these swf files is displayed only when the visitor visits the 
home page.
4) BOTH of these swf files are scripted into a template that is used for all 
pages. The first of them displays "over" the second (when it's the home page) 
and then is removed using css. This is why I can't have a traditional preloader 
page: I need to preserve those assets and not have them re-loaded whenever the 
splash page disappears and reveals the regular page with the second swf as an 
element within the html page that is generated from the template.

Now, the problem is that, for some reason, the "preloader" always, without 
fail, loads the graphics. It never seems to check if these graphics were 
cached, even though they were in fact cached in the browser. I wonder if the 
reason it doesn't check could be because I don't add the graphics to the stage 
(addChild), since I don't want them to appear on stage.


but if you don't want to this, maybe you could extract the problematic
part into a simple demo movie and put the FLA online, so anyone
interested can download and fix the code? I think that makes more sense
than posting longe code extracts here which then even aren't your actual
code.


I don't believe that would help. All you'll see is:
1) a counter showing how much is loaded, then;
2) a splash page, finally;
3) the template

In other words, exactly what I've already described. I hope I've clarified the 
problem.
Thanks,
John.

just my 2 cts.

cheers,
valentin
___
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] Re: swf doesn't work the same online

2010-03-10 Thread Glen Pike
From the look of it, the complaint is about "mynav" not existing on the 
parent clip - nsprite.  Because mynav is not a property of Sprite, you 
may have to use the DisplayObjectContainer methods to access mynav - 
again, I was working in AS2 "style", so directly accessing may not have 
worked for the AS3 version:


function onRolloverHandler(e:MouseEvent):void {
 var nsprite:Sprite = e.currentTarget as Sprite;
 if(nsprite) {
   var mynav:TextField = nsprite.getChildByName("mynav") as TextField;
   if(mynav) {
 TextField(nsprite.mynav).bgcolor = 0x97f9ec;
   } else {
 trace("can't find 'mynav' child of nsprite);
   }
 }
}





John Singleton wrote:

From: Glen Pike 
To: Flash Coders List 
Sent: Tue, March 9, 2010 1:26:14 PM
Subject: Re: [Flashcoders] Re: swf doesn't work the same online

Sorry, my typo / error.

You need to change bgcolor to backgroundColor in the event handler 
functions (bgcolor is not a property of TextField), e.g.


TextField(nsprite.mynav).backgroundColor = 0x...

No, I caught that and made the appropriate substitution. My vars are actually 
different than what I'm posting. That's not the problem. Please take a look at 
what I sent earlier.
Thanks,
John



John Singleton wrote:
  

From: Glen Pike 
To: Flash Coders List 
Sent: Tue, March 9, 2010 12:22:03 PM
Subject: Re: [Flashcoders] Re: swf doesn't work the same online

Hi,

   You need to make your nav function return the sprite it creates, so change the 
"signature" to:

function nav(nname:String, nurl:String, myX:int, bgcolor:uint):Sprite
   
and return "nsprite" at the bottom.


Thanks. That worked. Now I see that in your original instructions. Oops. I was doing this piecemeal and testing as I went along, sorry. 


Now I get this error:

Error: 1119: Access to possibly undefined property mynav...

I figured that might have something to do with not having defined bgcolor, so I 
added the following in the class' function definition:

var bgcolor:uint = new uint();

However, that then threw a new error:

Error #1151: A conflict exists with definition bgcolor

This, I assume, because of the following line:

function nav(nname:String, nurl:String, myx:int, bgcolor:uint):Sprite

That's the only place where that variable shows up and it of course is used in 
that function. I guess I'm confused as to how to work with those variables 
outside of the nav function, as you have me call them here:

function onRolloverHandler(e:MouseEvent):void {
  var nsprite:Sprite = e.currentTarget as Sprite;
  if(nsprite && nsprite.mynav) {
  TextField(nsprite.mynav).bgcolor = 0x97f9ec;
  }
}

which, of course, is where I'm getting in trouble.
Thanks,
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



  
___

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] Re: swf doesn't work the same online

2010-03-09 Thread Valentin Schmidt
hi john,

John Singleton wrote:
> Sorry, my typo / error.
> 
> You need to change bgcolor to backgroundColor in the event handler 
> functions (bgcolor is not a property of TextField), e.g.
> 
> TextField(nsprite.mynav).backgroundColor = 0x...
> 
> No, I caught that and made the appropriate substitution. My vars are
> actually different than what I'm posting. That's not the problem.
> Please take a look at what I sent earlier. Thanks, John

first, your emails are a bit hard to read, I'd suggest to quote
correctly (see e.g. http://mailformat.dan.info/quoting/), or better, use
an email client that takes care of correct quoting (and configure it
accordingly).

second, I have the impression that this thread could go on forever
without getting anywhere. Maybe it would be a good idea to do a fresh
start, and this time first create a clear conception of what you want to
achieve (in each function), e.g. by describing it in plain english,
before writing your actual code?
but if you don't want to this, maybe you could extract the problematic
part into a simple demo movie and put the FLA online, so anyone
interested can download and fix the code? I think that makes more sense
than posting longe code extracts here which then even aren't your actual
code.

just my 2 cts.

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


Re: [Flashcoders] Re: swf doesn't work the same online

2010-03-09 Thread John Singleton
From: Glen Pike 
To: Flash Coders List 
Sent: Tue, March 9, 2010 1:26:14 PM
Subject: Re: [Flashcoders] Re: swf doesn't work the same online

Sorry, my typo / error.

You need to change bgcolor to backgroundColor in the event handler 
functions (bgcolor is not a property of TextField), e.g.

TextField(nsprite.mynav).backgroundColor = 0x...

No, I caught that and made the appropriate substitution. My vars are actually 
different than what I'm posting. That's not the problem. Please take a look at 
what I sent earlier.
Thanks,
John



John Singleton wrote:
> From: Glen Pike 
> To: Flash Coders List 
> Sent: Tue, March 9, 2010 12:22:03 PM
> Subject: Re: [Flashcoders] Re: swf doesn't work the same online
>
> Hi,
>
>You need to make your nav function return the sprite it creates, so change 
> the "signature" to:
>
> function nav(nname:String, nurl:String, myX:int, bgcolor:uint):Sprite
>
> and return "nsprite" at the bottom.
>
> Thanks. That worked. Now I see that in your original instructions. Oops. I 
> was doing this piecemeal and testing as I went along, sorry. 
>
> Now I get this error:
>
> Error: 1119: Access to possibly undefined property mynav...
>
> I figured that might have something to do with not having defined bgcolor, so 
> I added the following in the class' function definition:
>
> var bgcolor:uint = new uint();
>
> However, that then threw a new error:
>
> Error #1151: A conflict exists with definition bgcolor
>
> This, I assume, because of the following line:
>
> function nav(nname:String, nurl:String, myx:int, bgcolor:uint):Sprite
>
> That's the only place where that variable shows up and it of course is used 
> in that function. I guess I'm confused as to how to work with those variables 
> outside of the nav function, as you have me call them here:
>
> function onRolloverHandler(e:MouseEvent):void {
>   var nsprite:Sprite = e.currentTarget as Sprite;
>   if(nsprite && nsprite.mynav) {
>   TextField(nsprite.mynav).bgcolor = 0x97f9ec;
>   }
> }
>
> which, of course, is where I'm getting in trouble.
> Thanks,
> 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



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


Re: [Flashcoders] Re: swf doesn't work the same online

2010-03-09 Thread Glen Pike

Sorry, my typo / error.

You need to change bgcolor to backgroundColor in the event handler 
functions (bgcolor is not a property of TextField), e.g.


TextField(nsprite.mynav).backgroundColor = 0x...



John Singleton wrote:

From: Glen Pike 
To: Flash Coders List 
Sent: Tue, March 9, 2010 12:22:03 PM
Subject: Re: [Flashcoders] Re: swf doesn't work the same online

Hi,

   You need to make your nav function return the sprite it creates, so change the 
"signature" to:

function nav(nname:String, nurl:String, myX:int, bgcolor:uint):Sprite

and return "nsprite" at the bottom.


Thanks. That worked. Now I see that in your original instructions. Oops. I was doing this piecemeal and testing as I went along, sorry. 


Now I get this error:

Error: 1119: Access to possibly undefined property mynav...

I figured that might have something to do with not having defined bgcolor, so I 
added the following in the class' function definition:

var bgcolor:uint = new uint();

However, that then threw a new error:

Error #1151: A conflict exists with definition bgcolor

This, I assume, because of the following line:

function nav(nname:String, nurl:String, myx:int, bgcolor:uint):Sprite

That's the only place where that variable shows up and it of course is used in 
that function. I guess I'm confused as to how to work with those variables 
outside of the nav function, as you have me call them here:

function onRolloverHandler(e:MouseEvent):void {
  var nsprite:Sprite = e.currentTarget as Sprite;
  if(nsprite && nsprite.mynav) {
  TextField(nsprite.mynav).bgcolor = 0x97f9ec;
  }
}

which, of course, is where I'm getting in trouble.
Thanks,
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] Re: swf doesn't work the same online

2010-03-09 Thread John Singleton
From: Glen Pike 
To: Flash Coders List 
Sent: Tue, March 9, 2010 12:22:03 PM
Subject: Re: [Flashcoders] Re: swf doesn't work the same online

Hi,

   You need to make your nav function return the sprite it creates, so change 
the "signature" to:

function nav(nname:String, nurl:String, myX:int, bgcolor:uint):Sprite

and return "nsprite" at the bottom.

Thanks. That worked. Now I see that in your original instructions. Oops. I was 
doing this piecemeal and testing as I went along, sorry. 

Now I get this error:

Error: 1119: Access to possibly undefined property mynav...

I figured that might have something to do with not having defined bgcolor, so I 
added the following in the class' function definition:

var bgcolor:uint = new uint();

However, that then threw a new error:

Error #1151: A conflict exists with definition bgcolor

This, I assume, because of the following line:

function nav(nname:String, nurl:String, myx:int, bgcolor:uint):Sprite

That's the only place where that variable shows up and it of course is used in 
that function. I guess I'm confused as to how to work with those variables 
outside of the nav function, as you have me call them here:

function onRolloverHandler(e:MouseEvent):void {
  var nsprite:Sprite = e.currentTarget as Sprite;
  if(nsprite && nsprite.mynav) {
  TextField(nsprite.mynav).bgcolor = 0x97f9ec;
  }
}

which, of course, is where I'm getting in trouble.
Thanks,
John


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


Re: [Flashcoders] Re: swf doesn't work the same online

2010-03-09 Thread Valentin Schmidt
John Singleton wrote:
> From: Glen Pike  To: Flash Coders List
>  Sent: Mon, March 8, 2010 3:04:47
> PM Subject: Re: [Flashcoders] Re: swf doesn't work the same online
> 
> var nNavs:Array = new Array(); for(var i:int = 0; i < numLinks;i++) {
>  var nav:Sprite = nav(nNames[i], nUrls[i], positions[i], 0x0e778a);
> 
> It throws error 1067 on the above line: implicit coercion of value
> type void to an unrelated type flash.display.Sprite, which frankly
> makes sense; however, I'm not sure how I should create the variable
> to push it onto the stack by doing otherwise. Thanks, John

are you really using glen's nav() function that returns a sprite, and
not accidently your original version?

and a remark: I'd recomemnd to avoid to sue the same variable name both
for a function and a local variable, this means asking for trouble
(althouight it propably works in your code as long as the nav variable
is local and the nav function is global).

cheers,
valentin

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


Re: [Flashcoders] Re: swf doesn't work the same online

2010-03-09 Thread Glen Pike

Hi,

   You need to make your nav function return the sprite it creates, so 
change the "signature" to:


function nav(nname:String, nurl:String, myX:int, bgcolor:uint):Sprite

 and return "nsprite" at the bottom.

Glen


John Singleton wrote:

From: Glen Pike 
To: Flash Coders List 
Sent: Mon, March 8, 2010 3:04:47 PM
Subject: Re: [Flashcoders] Re: swf doesn't work the same online

var nNavs:Array = new Array();
for(var i:int = 0; i < numLinks;i++) {
   var nav:Sprite = nav(nNames[i], nUrls[i], positions[i], 0x0e778a);

It throws error 1067 on the above line: implicit coercion of value type void to an unrelated type flash.display.Sprite, which frankly makes sense; however, I'm not sure how I should create the variable to push it onto the stack by doing otherwise. 
Thanks,

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] Re: swf doesn't work the same online

2010-03-09 Thread John Singleton
From: Glen Pike 
To: Flash Coders List 
Sent: Mon, March 8, 2010 3:04:47 PM
Subject: Re: [Flashcoders] Re: swf doesn't work the same online

var nNavs:Array = new Array();
for(var i:int = 0; i < numLinks;i++) {
   var nav:Sprite = nav(nNames[i], nUrls[i], positions[i], 0x0e778a);

It throws error 1067 on the above line: implicit coercion of value type void to 
an unrelated type flash.display.Sprite, which frankly makes sense; however, I'm 
not sure how I should create the variable to push it onto the stack by doing 
otherwise. 
Thanks,
John


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


Re: [Flashcoders] Re: swf doesn't work the same online

2010-03-08 Thread Glen Pike

Hi,

   You are creating your sprites inside your nav function as local 
variables - they are probably getting garbage collected because as soon 
as nav returns nsprite will cease to exist in your code and will be 
"reaped" by the gc at any time the Flash Player chooses after that.


   I recommend you do something like the following which means your nav 
function returns the Sprite you create and you store it, meaning it 
won't get garbage collected.


   HTH

   Glen

//create an array of nname, nurl, strings (shortened for convenience.:
var nNames:Array = ["Home", "Bathroom", ...];
var nUrls:Array = ["index", "Bathroom", ];
var positions:Array [


//loop through the arrays and create each navigation element, then 
return it...

var numLinks = nNames.length();

var nNavs:Array = new Array();
for(var i:int = 0; i < numLinks;i++) {
   var nav:Sprite = nav(nNames[i], nUrls[i], positions[i], 0x0e778a);
   nNavs.push(nav);
   //do anything else you need to do to the nav sprite here.
}

//make nav return the sprite it creates.
function nav(...):Sprite {
   //create stuff
   //...
   //Create mynav text field with a name attribute!
   mynav.name = "mynav";
   //add listeners
   //
   return nsprite;
}

function onRolloverHandler(e:MouseEvent):void {
   var nsprite:Sprite = e.currentTarget as Sprite;
   if(nsprite && nsprite.mynav) {
  TextField(mysprite.mynav).bgcolor = 0x97f9ec;
   }
}

//Repeat for the other listener handlers.



John Singleton wrote:
Here's the complete code. Again, all this works fine in my swf in Flash, but when I upload the swf it breaks when I roll over "Home". The color changes and won't change back when I roll out. No other nav widget works at all. 


function nav(nname:String, nurl:String, myX:int, bgcolor:uint):void
{
myfont2 = 'Arial';
mydize = 15;
mytxtcolor = 0x00;
myborder = true;
mybordercolor = 0xFF;
myY = 170;
myfill = 0x97f9ec;
mynav = new TextField();
var format:TextFormat = new TextFormat();
format.font = myfont2;
format.size = mysize;
mynav.htmlText = '' + nname + '';
mynav.textColor = myTextColor;
mynav.border = myborder;
mynav.borderColor = mybordercolor;
mynav.background=true;
mynav.backgroundColor = bgcolor;
mynav.autoSize = TextFieldAutoSize.LEFT;
mynav.x = myX;
mynav.y = myY;
mynav.setTextFormat(format);
var navdrop:DropShadowFilter = new DropShadowFilter();
navdrop.color = 0x00;
navdrop.blurX = 3;
navdrop.blurY = 3;
navdrop.angle = 0;
navdrop.alpha = 0.5;
navdrop.distance = 3;
var navfilters:Array = new Array(navdrop);
mynav.filters = navFiltersArray;
var nsprite:Sprite = new Sprite();
addChild(nsprite);
nsprite.name = nname;
nsprite.addChild(mynav);
var len:int = mynav.numLines;
for (var i:int = 0; i < len; i++) 
{

var metrics:TextLineMetrics = mynav.getLineMetrics(i);
with(nsprite.graphics)
{
beginFill(myfill, 1);
drawRect(mynav.x, mynav.y, metrics.width + 4, 
metrics.height + metrics.descent + 1);
endFill();
}
}
addChild(nsprite);
nsprite.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler);
nsprite.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler);
nsprite.addEventListener(MouseEvent.CLICK, onClickHandler);
nsprite.addEventListener(MouseEvent.MOUSE_DOWN, onPressHandler);
nsprite.addEventListener(MouseEvent.MOUSE_UP, onReleaseHandler);
nsprite.mouseChildren = false;
nsprite.buttonMode = true;
}

function onRollOverHandler(e:MouseEvent) 
{
if (e.currentTarget.name == ' Home ') 
{

nav(' Home ', 'index', 235, 0x97f9ec);
} else if (e.currentTarget.name == ' Bathroom ') {
nav(' Bathroom ', 'Bathroom', 295, 0x97F9EC);
} else if (e.currentTarget.name == ' Bedroom ') {
nav(' Bedroom ', 'Bedroom', 415, 0x97F9EC);
} else if (e.currentTarget.name == ' Dining Room ') {
nav(' Dining Room ', 'Dining_Room', 485, 0x97F9EC);
} else if (e.currentTarget.name == ' Forms ') {
nav(' Forms ', 'Forms', 642, 0x97F9EC);
} else if (e.currentTarget.name == ' About Us ') {
nav(' About Us ', 'About_Us', 703, 0x97F9EC);
} else if (e.currentTarget.name == ' Contact Us ') {
nav(' Contact Us ', 'Contact_Us', 782, 0x97F9EC);
}
}

function onRollOutHandler(e:MouseEvent)
{
if (e.currentTarget.name == ' Home ') 
{

nav(' Home ', 'index', 235, 0x0e778a);
} else if (e.currentTarget.name == ' Bathroom ') {
nav(' Bathroom ', 'Bathroom', 295, );
} else if (e.currentTarget.name == '

[Flashcoders] Re: swf doesn't work the same online

2010-03-08 Thread John Singleton
Here's the complete code. Again, all this works fine in my swf in Flash, but 
when I upload the swf it breaks when I roll over "Home". The color changes and 
won't change back when I roll out. No other nav widget works at all. 

function nav(nname:String, nurl:String, myX:int, bgcolor:uint):void
{
myfont2 = 'Arial';
mydize = 15;
mytxtcolor = 0x00;
myborder = true;
mybordercolor = 0xFF;
myY = 170;
myfill = 0x97f9ec;
mynav = new TextField();
var format:TextFormat = new TextFormat();
format.font = myfont2;
format.size = mysize;
mynav.htmlText = '' + nname + '';
mynav.textColor = myTextColor;
mynav.border = myborder;
mynav.borderColor = mybordercolor;
mynav.background=true;
mynav.backgroundColor = bgcolor;
mynav.autoSize = TextFieldAutoSize.LEFT;
mynav.x = myX;
mynav.y = myY;
mynav.setTextFormat(format);
var navdrop:DropShadowFilter = new DropShadowFilter();
navdrop.color = 0x00;
navdrop.blurX = 3;
navdrop.blurY = 3;
navdrop.angle = 0;
navdrop.alpha = 0.5;
navdrop.distance = 3;
var navfilters:Array = new Array(navdrop);
mynav.filters = navFiltersArray;
var nsprite:Sprite = new Sprite();
addChild(nsprite);
nsprite.name = nname;
nsprite.addChild(mynav);
var len:int = mynav.numLines;
for (var i:int = 0; i < len; i++) 
{
var metrics:TextLineMetrics = mynav.getLineMetrics(i);
with(nsprite.graphics)
{
beginFill(myfill, 1);
drawRect(mynav.x, mynav.y, metrics.width + 4, 
metrics.height + metrics.descent + 1);
endFill();
}
}
addChild(nsprite);
nsprite.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler);
nsprite.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler);
nsprite.addEventListener(MouseEvent.CLICK, onClickHandler);
nsprite.addEventListener(MouseEvent.MOUSE_DOWN, onPressHandler);
nsprite.addEventListener(MouseEvent.MOUSE_UP, onReleaseHandler);
nsprite.mouseChildren = false;
nsprite.buttonMode = true;
}

function onRollOverHandler(e:MouseEvent) 
{
if (e.currentTarget.name == ' Home ') 
{
nav(' Home ', 'index', 235, 0x97f9ec);
} else if (e.currentTarget.name == ' Bathroom ') {
nav(' Bathroom ', 'Bathroom', 295, 0x97F9EC);
} else if (e.currentTarget.name == ' Bedroom ') {
nav(' Bedroom ', 'Bedroom', 415, 0x97F9EC);
} else if (e.currentTarget.name == ' Dining Room ') {
nav(' Dining Room ', 'Dining_Room', 485, 0x97F9EC);
} else if (e.currentTarget.name == ' Forms ') {
nav(' Forms ', 'Forms', 642, 0x97F9EC);
} else if (e.currentTarget.name == ' About Us ') {
nav(' About Us ', 'About_Us', 703, 0x97F9EC);
} else if (e.currentTarget.name == ' Contact Us ') {
nav(' Contact Us ', 'Contact_Us', 782, 0x97F9EC);
}
}

function onRollOutHandler(e:MouseEvent)
{
if (e.currentTarget.name == ' Home ') 
{
nav(' Home ', 'index', 235, 0x0e778a);
} else if (e.currentTarget.name == ' Bathroom ') {
nav(' Bathroom ', 'Bathroom', 295, 0x0e778a);
} else if (e.currentTarget.name == ' Bedroom ') {
nav(' Bedroom ', 'Bedroom', 415, 0x0e778a);
} else if (e.currentTarget.name == ' Dining Room ') {
nav(' Dining Room ', 'Dining_Room', 485, 0x0e778a);
} else if (e.currentTarget.name == ' Forms ') {
nav(' Forms ', 'Forms', 642, 0x0e778a);
} else if (e.currentTarget.name == ' About Us ') {
nav(' About Us ', 'About_Us', 703, 0x0e778a);
} else if (e.currentTarget.name == ' Contact Us ') {
nav(' Contact Us ', 'Contact_Us', 782, 0x0e778a);
}
}

function onClickHandler(e:MouseEvent)
{
mynav.textColor = 0x00;
mynav.borderColor = 0xFF;
}

function onPressHandler(e:MouseEvent)
{
if (e.currentTarget.name == ' Home ') 
{
nav(' Home ', 'index', 235, 0xff);
} else if (e.currentTarget.name == ' Bathroom ') {
nav(' Bathroom ', 'Bathroom', 295, 0xff);
} else if (e.currentTarget.name == ' Bedroom ') {
nav(' Bedroom ', 'Bedroom', 415, 0xff);
} else if (e.currentTarget.name == ' Dining Room ') {
nav(' Dining Room ', 'Dining_Room', 485, 0xff);
} else if (e.currentTarget.name == ' Forms ') {
nav(' Forms ', 'Forms', 642, 0xff);
} else if (e.currentTarget.name == ' About Us ') {
nav(' About Us ', 'About_Us', 703, 0xff);
} else if (e.currentTarget.name == ' Contact Us ') {
nav(' Contact Us ', 'Contact_Us', 782, 0xff);
}
}

function onReleaseHandler(e:MouseEvent)
{
if (e.currentTarget.name == ' Home ') 
{
nav(' Home ', 'index', 235, 0x0e778a);
} else if (e.currentTarget.name == ' Bathroom ') {
nav(' Bathroom ', 'Bathroom', 295, 0x0e