PDA

View Full Version : how to change borderStyle in TitleWindow


jordiaseques
09-11-2009, 09:06 PM
I want to shot a popup with a TitleWindow. Depending on the picture should be a TitleWindow with borderStyler=”none” or borderStyle=”true”.
With the first 10 pictures I want borderStyle=”none”
Next pictures I want borderStyle=”true”

How can I do it? I wrote the code to give more information:

in my principal mxml when I press a button it goes to the next event:


private function Triarfoto(event:MouseEvent):void
{
Iddelboton= event.target.id;
fotonumero=Iddelboton.substring(4,6);
nombrefoto="foto"+fotonumero+".jpg";
centradox=Number(Iddelboton.substring(17,20));
centradoy=Number(Iddelboton.substring(21,24));
nomprofe=matriunoms[Number(fotonumero)-1];
PopUpManager.addPopUp( new DisparaPopUp2(), this, true);
}

The most important now is the var nombrefoto. Nombrefoto can get the next values:

foto01.jpg
foto02.jpg
foto03.jpg
...
foto20.jpg
...
in the next code I explain how is DisparaPopUp2.mxml :

<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" showCloseButton = "true" layout="vertical" creationComplete="centerMe()"
close="PopUpManager.removePopUp(this);" xmlns:local="*" borderStyle="none" borderColor="#FFFFF" backgroundColor="#FFFFFF">

<mx:Script>
<![CDATA[
import mx.managers.PopUpManager;
import mx.core.Application;
public function centerMe():void
{
this.move(Application.application.centradox,Applic ation.application.centradoy);
}
]]>
</mx:Script>
<mx:ModuleLoader url="Modulfotos2.swf" /> // Here goes to charge the photo
</mx:TitleWindow>


Can you help me please?
Thanks
Jordi

sydd_hu
09-12-2009, 02:18 PM
1. Titlewindow has the following border styes: none, inset,solid,outset.

i'd do something like this:

private function Triarfoto(event:MouseEvent):void
{
Iddelboton= event.target.id;
fotonumero=Iddelboton.substring(4,6);
nombrefoto="foto"+fotonumero+".jpg";
centradox=Number(Iddelboton.substring(17,20));
centradoy=Number(Iddelboton.substring(21,24));
nomprofe=matriunoms[Number(fotonumero)-1];
var mypopup = PopUpManager.addPopUp( new DisparaPopUp2(), this, true);
if (nombrefoto<11){
mypopup.setBorder("none")
}
}


<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" showCloseButton = "true" layout="vertical" creationComplete="centerMe()"
close="PopUpManager.removePopUp(this);" xmlns:local="*" borderStyle="none" borderColor="#FFFFF" backgroundColor="#FFFFFF">

<mx:Script>
<![CDATA[
import mx.managers.PopUpManager;
import mx.core.Application;
public function centerMe():void
{
this.move(Application.application.centradox,Applic ation.application.centradoy);
}
public function setBorder(stylename:String):void{
setStyle("borderStyle",stylename)
}

]]>
</mx:Script>
<mx:ModuleLoader url="Modulfotos2.swf" /> // Here goes to charge the photo
</mx:TitleWindow>


note: i havent tested this, it might have some errors