In Flex, I am using
var canvasEdit:Canvas = new Canvas();
canvasEdit.setStyle("borderColor", 0x0134FF);
canvasEdit.setStyle("borderThickness", 3);
But I am not able to put border on the sides of the Canvas.
Try adding the following line:
canvasEdit.setStyle("borderStyle","solid");
...for example, here is a full application file example:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
<mx:Script>
<![CDATA[
protected function init():void
{
canvasEdit.setStyle("borderStyle","solid");
canvasEdit.setStyle("borderColor","#000000");
canvasEdit.setStyle("borderThickness","5");
}
]]>
</mx:Script>
<mx:Canvas width="200" height="200" x="0" y="0" id="canvasEdit"/>
</mx:Application>
Related
i really don't understand what i am doing wrong:
It's simple example, but when i click on the button nothing happens..
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955"minHeight="600">
<fx:Script>
<![CDATA[
private function drawLine():void
{
var myShape:Shape = new Shape();
myShape = new Shape() ;
myShape.graphics.lineStyle(2, 0x990000, .75);
myShape.graphics.moveTo(100, 100);
myShape.graphics.lineTo(25, 45);
this.addChild(myShape);
}
]]>
</fx:Script>
<!--<mx:Label text="Hello World"/>-->
<mx:Button label="Click" click="drawLine()" />
</s:Application>
Use SpriteVisualElement for adding simple non-flex objects.
<s:SpriteVisualElement width="500" height="500" id="spr"/>
spr.addChild(myShape)
I have this ViewNavigator inside a callout and the callout displays a view inside it using firstView="views.ListMenusHomeView" . Now how can I close the callout from ListMenusHomeView? Hope someone can help.
Here is my code for the callout:
<?xml version="1.0" encoding="utf-8"?>
<s:Callout xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
contentBackgroundAppearance="none"
height="300" width="300">
<fx:Declarations>
<fx:XML id="menu" source="xmldata/menu2.xml" />
</fx:Declarations>
<fx:Script>
<![CDATA[
import spark.events.PopUpEvent;
protected function back(event:MouseEvent):void {
if(viewNav.length>1)
viewNav.popView();
}
]]>
</fx:Script>
<s:ViewNavigator id="viewNav" width="100%" height="100%" firstView="views.ListMenusHomeView">
<s:navigationContent>
<s:Button label="Back" click="back(event)"/>
</s:navigationContent>
<s:actionContent>
<s:Button label="Cancel" click="close(false)" emphasized="true"/>
</s:actionContent>
</s:ViewNavigator>
</s:Callout>
You see that there is a ViewNavigator which holds the ListMenusHomeView. This is the code for the ListMenusHomeView.
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" title="Main Menu" creationComplete="onCreationComplete()">
<fx:Declarations>
<fx:XML id="menu" source="xmldata/menu2.xml" />
</fx:Declarations>
<fx:Script>
<![CDATA[
import com.adobe.serializers.xml.XMLDecoder;
import mx.collections.ArrayCollection;
import spark.events.IndexChangeEvent;
[Bindable]
private var dataArray:ArrayCollection = new ArrayCollection();
private var object:DataArray = new DataArray();
private function onCreationComplete() : void{
var decoder:XMLDecoder = new XMLDecoder();
var resultObj:Object = decoder.decode(menu);
dataArray = object.onCreationComplete(menu, menu.menuitem, resultObj, resultObj.menuitem);
}
protected function list1_changeHandler(event:IndexChangeEvent):void
{
}
]]>
</fx:Script>
<s:List id="tileLayout"
width="100%" height="100%"
verticalScrollPolicy="off" horizontalScrollPolicy="on"
pageScrollingEnabled="true" dataProvider="{dataArray}"
itemRenderer="renderers.iconList2" change="list1_changeHandler(event)">
<s:layout>
<s:TileLayout orientation="columns" requestedRowCount="3"
verticalGap="20" horizontalGap="20"/>
</s:layout>
</s:List>
Now I want to close MyCallout whenever I click an icon inside ListMenusHomeView. The function list1_changeHandler(event:IndexChangeEvent) is responsible for that one.
What should I do?
The Callout class has a close() method, so you basically just need to access the ListMenusHomeViews parentDocument (which would be your "viewNav" ViewNavigator) and its parentDocument, which should be your ListMenusHomeView.
I haven't tested it but you might fiddle around with the parentDocument, parent and owner properties to access the correct object. Try them with a simple trace and you'll be up and running in no time.
i have call my mxml file that I have done in to the pop up window. However it did nt fit to the frame.I tried to extend the frame however only the frame extends the content area did not . Why so?
This is my pop up codes :
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml"
title="Interdepartment Relationship" x="300" y="30" showCloseButton="true" close="PopUpManager.removePopUp(this);" borderAlpha="0.25" width="1000" height="800" xmlns:ilog="http://www.ilog.com/2007/ilog/flex" xmlns:diagram="http://www.ibm.com/xmlns/prod/ilog/elixir/diagram/2010" xmlns:local="*">
<mx:Script>
<![CDATA[
import mx.managers.PopUpManager;
]]>
</mx:Script>
<local:desmondinterrls/>
<mx:Button label="Cancel" click="PopUpManager.removePopUp(this);"/>
</mx:TitleWindow>
How to chnage progress bar color to green in the following code
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
width="100"
height="100"
creationComplete="init()">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import flash.net.NetStream;
private var myMic:Microphone;
private var nc:NetConnection;
private function init():void {
initMic("0x19D319");
myMic = Microphone.getMicrophone();
myMic.setSilenceLevel(0);
myMic.rate = 44;
myMic.gain = 100;
//myMic.setUseEchoSuppression(true);
Security.showSettings(SecurityPanel.MICROPHONE);
micLevel.visible = true;
myMic.setLoopBack(true);
addEventListener(Event.ENTER_FRAME, showMicLevel);
if (myMic != null)
{
micLevel.setProgress(myMic.activityLevel, 100);
}
}
private function showMicLevel(event:Event):void{
micLevel.setStyle("barColor", 0xf4b60f);
switch (recordingState){
case "idle" :
micLevel.setProgress(myMic.activityLevel, 100);
break;
case "idle" :
Alert.show("2");
micLevel.setProgress(myMic.activityLevel, 100);
break;
case "playing" :
micLevel.setProgress(ns.time, myDuration);
break;
}
}
private function initMic(myColor:String):void{
micLevel.setStyle("barColor", myColor);
}
]]>
</mx:Script>
<mx:ProgressBar x="0" y="36" mode="manual" id="micLevel" label="" labelPlacement="bottom" width="100" fontSize="10" fontWeight="normal"/>
</mx:Application>
You have the following properties to control the appearance of the progress bar
barColor="undefined"
barSkin="ProgressBarSkin"
borderColor="0xAAB3B3"
color="0x0B333C"
disabledColor="0xAAB3B3"
For more detailed information, refer to the documentation.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:ProgressBar indeterminate="true" width="100%"
label="Ankur Sharma" bottom="10" barColor="#FF0000" trackHeight="15"/>
<mx:ProgressBar indeterminate="true" width="100%" fontWeight="normal"
trackHeight="20" barColor="#333333" verticalGap="0" label="caseable.com"/>
</mx:Application>
hi, Check this progress bar work, may be u'd be luking for this
Ankur
barColor style property must be set to container that contains ProgressBar.
From docs:
This style has no effect on other
components, but can be set on a
container to control the appearance of
all progress bars found within.
I want to use an image in my checkbox as label, anybody know how ?
When I tried doing the same thing with a RadioButton a while back, I ended up having to create my own component. This is what I did:
IconRadioButton.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.controls.RadioButtonGroup;
[Bindable]
public var imgLabel:Class;
[Bindable]
public var groupName:RadioButtonGroup;
[Bindable]
public var selected:Boolean;
[Bindable]
public var value:String;
]]>
</mx:Script>
<mx:RadioButton
id="radioBtn"
group="{groupName}"
groupName="{groupName}"
selected="{selected}"
label=""
value="{value}"
visible="{visible}"
includeInLayout="{includeInLayout}" />
<mx:Image source="{imgLabel}" click="{radioBtn.selected = true}" />
</mx:HBox>
Then you could use it like this:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:controls="com.example.controls.*">
<controls:IconRadioButton
groupName="{group}"
imgLabel="{AssetsFactory.getInstance().iconCCVisa}"
value="{CreditCardTypes.VISA}" />
...
Hope that maybe gets you started or gives you some ideas.
To use image as label, use the following code.
<mx:HBox width="100%">
<mx:RadioButton groupName="Yield"/>
<mx:Image source="#Embed('/scripts/btn_highest.png')"/>
</mx:HBox>