Jump to content


Photo

Why can't I set the visible state of an effect?


  • Please log in to reply
7 replies to this topic

#1 stowball

stowball

    Fireworks Ninja

  • FwGurus
  • PipPipPipPipPip
  • 190 posts
  • Location:Newcastle, Australia

Posted 28 September 2007 - 04:01 AM

I'm trying to temporarily hide any effects on an object, and then later restore them, but I can't get it to work.

Here's my initial attempt:

if (fw.selection[0].effectList) {
	if (fw.selection[0].effectList.effects.length > 0) {
		var effectArray = new Array(fw.selection[0].effectList.effects.length);
		for (i=0; i<fw.selection[0].effectList.effects.length; i++) {
			effectArray[i] = fw.selection[0].effectList.effects[i].EffectIsVisible;
			fw.selection[0].effectList.effects[i].EffectIsVisible = false;
			alert(fw.selection[0].effectList.effects[i].EffectIsVisible);
		}
	}
}

For some reason, setting EffectIsVisible to false has no effect. As can be seen in the alert and in the effects list :(

What am I doing wrong?

Thanks

#2 abeall

abeall

    FireworksNut

  • Administrators
  • PipPipPipPipPipPip
  • 523 posts

Posted 28 September 2007 - 07:15 AM

I think I remember running into this... if you look at the Effects commands I made you'll see that I [unfortunately] duplicate the whole effect via for..in, then re-apply the effect over the original(and skip javascriptString):
//Turns off all Live Effects on selected objects
//Aaron Beall - http://abeall.com

var sel = new Array().concat(fw.selection);
if(sel.length <= 0){
	alert('This command requires an active selection!');
}else{
	for(var i in sel){
		if(!sel[i].effectList)continue;
		var effs = sel[i].effectList.effects;
		for(f in effs){
			var eff = {};
			for(var p in effs[f]){
				if(p!='javascriptString')eff[p] = effs[f][p];
			}
			eff.EffectIsVisible = false;
			effs[f] = eff;
		}
	}

}

There are so many properties throughout the API that don't seem to want to change, even if they aren't supposed to be read-only.

#3 stowball

stowball

    Fireworks Ninja

  • FwGurus
  • PipPipPipPipPip
  • 190 posts
  • Location:Newcastle, Australia

Posted 29 September 2007 - 04:43 PM

Thanks Aaron. Geez the API make it much more difficult than it should be!

So using your example, I can disable all the effects, but I'm having real trouble restoring them to their original state.

Sometimes I think I get close, but I really don't know what I'm doing :(

Can you help?

Oh, and on a different note, for some reason, the first time I browse to your website (in a session), it can't connect - Firefox can't find the server at fireworks.abeall.com. But refreshing then works. This happens everytime....

Cheers

#4 stowball

stowball

    Fireworks Ninja

  • FwGurus
  • PipPipPipPipPip
  • 190 posts
  • Location:Newcastle, Australia

Posted 30 September 2007 - 03:46 AM

I did it!!!!!

I'll post my extension tomorrow. It's not that exciting, but I'm one happy bunny...

#5 abeall

abeall

    FireworksNut

  • Administrators
  • PipPipPipPipPipPip
  • 523 posts

Posted 04 October 2007 - 07:17 PM

Oh, and on a different note, for some reason, the first time I browse to your website (in a session), it can't connect - Firefox can't find the server at fireworks.abeall.com. But refreshing then works. This happens everytime....


Wackiness, wish I had a clue about servers, I have no idea what might cause that. You still getting that problem? Does it do the same thing for the superdomain, http://abeall.com?

So, let's see that extension. :)

#6 so1980==MikeTaylor

so1980==MikeTaylor

    FireworksNut

  • FwGurus
  • PipPipPipPipPipPip
  • 645 posts
  • Location:Brooklyn, New York, USA
  • Interests:Fireworks, Sociolinguistics, Dialects, New York City, &amp; Burritos.

Posted 05 October 2007 - 02:30 PM

hey, i connect every time in firefox without a problem.

#7 stowball

stowball

    Fireworks Ninja

  • FwGurus
  • PipPipPipPipPip
  • 190 posts
  • Location:Newcastle, Australia

Posted 06 October 2007 - 02:32 AM

You still getting that problem? Does it do the same thing for the superdomain, http://abeall.com?

So, let's see that extension. :)


Aaron, yep I'm still getting the problem, and with the superdomain - maybe it's something my end. But yours is the only site I have connectivity issues with...

And the extension is my Make Guides From Selection v1.5 (first public release). You can get it here.

Cheers

#8 yanjuan

yanjuan

    Fireworks Sparkle

  • Members
  • Pip
  • 3 posts

Posted 16 December 2010 - 11:00 PM

Yeah same here...
We have the same issues...
If there's anybody out there who share something with regards to this please post it here and share..
Thanks...