Constant in a var?
Hi
Before I spend any more time trying, I was wondering if it's possible to use a var in place of a constant in dispatch event? I don't mean send var data as in a custom event, but use a var to dynamically change which constant you are refering to?
So...
public static const LOGIN_ADMINBTN:String = "Login_AdminBTN";
_myVar = "LOGIN_ADMINBTN";
dispatchEvent(new Event(_myVar))
...so that the event listener gets triggered in my view class...
addEventListener(Model.LOGIN_ADMINBTN, showDisplay);
...and if it was...
_myVar = "WHOOPA_BTN";
...this event listener gets triggered...
addEventListener(Model.WHOOPA_BTN, showDisplay);
Cheers guys
you can use a variable to reference an event which is what you're showing.
but i think you want the event dispatching object to be referenced by a variable. that's also possible but the object has to exist (in scope).
Similar Messages
-
What is the difference between Constant Window, Variable Window,Main Window
hello all
what is the difference between 1) Constant Window
2) Variable Window
3) Main Window in SAP SCRIPTHi,
Window Types
When defining a form window, you must select a window type for the window.
You can choose between three types:
Constant Windows (CONST)
Variable Windows (VAR)
Main Windows (MAIN)
Constant Windows (CONST)
Starting with Release 4.0, the system internally processes windows of type CONST similar to windows of type VAR.
Therefore, if you create a new window, always use type VAR.
Variable Windows (VAR)
The contents of variable windows is processed again for each page, on which the window appears.
The system outputs only as much text as fits into the window. Text exceeding the window size is truncated;
the system does not trigger a page break. Unlike constant windows, the page windows declared as variable windows may have different sizes on different form pages.
As far as the processing of the window contents is concerned, the system currently treats constant and variable windows alike.
The only difference is that constant windows have the same size throughout the form.
Main Windows (MAIN)
Each form must have one window of type MAIN. Such a window is called the main window of the form.
For SAPscript forms, the main window has a central meaning:
It controls the page break.
It contains the text body that may cover several pages.
It allows to fix text elements at the upper and lower margins of the allocated page window (for example, for column headings).
As soon as a window of type MAIN is full, SAPscript automatically triggers a page break and continues to
output the remaining text in the main window of the subsequent page. Page windows of type MAIN have the same width throughout the form.
The SAPscript composer thus avoids reformatting of the text after each page break.
If a page does not have a main window, the system implicitly processes all other windows of the page and continues with the subsequent page.
This page must not call itself as subsequent page (recursive call), since this would produce an endless loop.
In such a case, SAPscript terminates the output after three subsequent pages.
For printing header lines or totals, the different output areas of the main window are of special importance.
go through this links:
In Scripts Variable window and constant wind difference?
Main Window
Re: Main Window in SAP Script
What is the difference between Constant window and variable window?
Regards
Adil -
When is a def assigned to his constant value in a derived class ?
Hi ,
I encountered some strange thing in my app when using a def in a derived class from abstract base class. (dived by zero exception)
I point it out here using a small code snippet which reflects the problem in my app:
public abstract class Base{
public var varBase;
public class BaseDerived extends Base{
def const = 1;
var temp : Double;
public override var varBase on replace{
temp = varBase / const;
println("{const}");
function run(){
var test = BaseDerived {varBase:10};
println ("{test.temp}");
result is:
0
InfinityI assumed that all "defs" will already be assigned before any single use in the code when creating an object. If I put the "def" in the base class all works fine. But apparently this is not case when implementing an abstract class and use a def in that class.
What am I missing here ?
thanks
GuyI changed the code to:
public mixin class Base {
public var varBase;
init { println("Base Init"); }
postinit { println("Base PostInit"); }
public class BaseDerived extends Base {
def constant = 1;
var temp: Double;
init { println("BaseDerived Init"); }
postinit { println("BaseDerived PostInit"); }
public function showVar(msg: String) {
println("# BaseDerived ({msg})");
println("VarBase: {varBase}");
println("Constant: {constant}");
println("Temp: {temp}");
public override var varBase on replace {
showVar("Before computation");
temp = varBase / constant;
showVar("After computation");
function run() {
var test = BaseDerived { varBase: 10 };
test.showVar("Created test");
}The output of abstract class:
# BaseDerived (Before computation)
VarBase: 10.0
Constant: 0 --> BAD
Temp: 0.0
# BaseDerived (After computation)
VarBase: 10.0
Constant: 0
Temp: Infinity
Base Init
BaseDerived Init
Base PostInit
BaseDerived PostInit
# BaseDerived (Created test)
VarBase: 10.0
Constant: 1
Temp: Infinity --> NOK and replace not newly triggeredWhile the mixin base class indeed solves it:
# BaseDerived (Before computation)
VarBase: 10.0
Constant: 1 --> constant here already been assigned
Temp: 0.0
# BaseDerived (After computation)
VarBase: 10.0
Constant: 1
Temp: 10.0
Base Init
BaseDerived Init
Base PostInit
BaseDerived PostInit
# BaseDerived (Created test)
VarBase: 10.0
Constant: 1
Temp: 10.0 --> OKThanks for the quick goodies !
I just need to read something on what "mixin" differs from abstract.
cheers
Guy -
How to start animation from var
Am trying to start my symbol from a var... but it just don't works, even if i gave it constant
For example:
var s2 = 35000;
sym.getSymbol("second_arrow").play(s2);
Whats wrong with it??
thanksThe variable declared inside a function, can't be accessed outside of it.
So, better instead of declaring the variable "s" inside updateClock() function, declare it above that function definition, and things will work.
See below:
var s;
var updateClock = function(){
s = currentSeconds * 1000;
updateClock();
sym.getSymbol("second_arrow").play(s); // now "s" is accessible
hth,
Vivekuma -
Unable to turn column headers bold in Word table using VB Script
I have created a table in Microsoft Word 2010 using VB Script (this is via the script engine that forms part of HP Quality Centre functionality). The table itself is OK, 2 columns with centred headers. However, I am unable to make the column
headers bold. I have spent hours searching the net and trying various options to no avail can somebody please help me.
Set objWord = CreateObject("Word.Application")
Set objDocument = objword.Documents.Open(Src_Dir & template_file
Const wdAlignParagraphCenter = 1'var to control justification of the table columns
Const NUMBER_OF_ROWS = 1 'number of rows in intial table
Const NUMBER_OF_COLUMNS = 2 'number of colums in the intitial table
'search for the "TAA_TABLE" bookmark embedded in the document template, this is where the table will be created
Set objRange=objDocument.Bookmarks("TAA_TABLE").Range
'create the table
objDocument.Tables.Add objRange, NUMBER_OF_ROWS, NUMBER_OF_COLUMNS
Set objTable = objDocument.Tables(2)
'populate column headers
objTable.Cell(1, 1).Range.Font.Bold = True
objTable.Cell(1, 1).Range.Text = "Sub Contractor"
objTable.Cell(1, 2).Range.text = "TAA Number"
'centre the column headers
objDocument.Tables(2).Rows(1).Select
Set objSelection = objWord.Selection
objSelection.ParagraphFormat.Alignment = wdAlignParagraphCenter
'format the table with plain grid lines
objTable.AutoFormat(16)
'set the column widths
objTable.Columns(1).Setwidth 230,0
objTable.Columns(2).Setwidth 230,0
Any help is graetfully appreciated, as this is driving me wild.
Cheers,Hi Citronax,
I haved noticed that you used objTable.AutoFormat to format the table. Based on my understanding, this fuction will applie a predefined look to a table.
After I move the code which bolder the text behind this line of code, it works well for me.
'format the table with plain grid lines
objTable.AutoFormat (16)
objTable.Cell(1, 1).Range.Font.Bold = True
Regards & Fei
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Linking a JS object to ScriptUI listbox item
I am writing a script that that takes elements from a document and for each element makes a custom object with its own properties and methods. This list of elements is then spat out into a ScriptsUI listbox.
How do I link each listbox item to its associated obejct? i.e. So if I double click on a listbox item it will run a particular method within that object.
P.S. I dont want to have to store array ids in a column or something hacky like that.Yep, it seems that the Translator component of the MVVM pattern wouldn't be very useful in a ScriptUI perspective.
The most asbtract pattern you have to deal with, I think, is the GenericList widget (ListBox, DropDownList, maybe TreeView?) and its relationship with what we may call a DataProvider (following Flex and .NET terminology). But ScriptUI/ExtendScript does not allow a serious level of data binding.
The whole problem is to emulate something of a dynamic link so that the data provider can notify the List widget of some changing. As a response, the List then would update its items accordingly. A skeleton of this approach could be drawn using custom event notification:
const EXTERNAL_EVENT_TYPE = 'myEventType';
var externalProcess = function F()
if( F.targetWidget )
F.targetWidget.dispatchEvent(new UIEvent(EXTERNAL_EVENT_TYPE));
// =====================================
// UI
// =====================================
var w = new Window('dialog', "Example"),
// register the LB as a target:
lb = externalProcess.targetWidget = w.add('listbox'),
b = w.add('button',undefined,"Test Change");
lb.addEventListener(
EXTERNAL_EVENT_TYPE,
function(){ alert("Something is happening. I need to update my items!"); }
b.onClick = externalProcess;
w.show();
but I'm afraid this code—which, by the way, works!—leads us to an anti-pattern! Indeed, while we have to register and maintain a reference to the List widget in the external object (which is assumed to wrap the data), we still need to tell the list how to access the data provider in order to update the list items. The only benefit of the scheme above is that the external process can notify the list at any moment. Maybe this could make some sense in a non-modal context (palette), but this doesn't solve the original problem.
So, intuitively, I would tend to take the opposite view: instead of making the external process trigger some event in the UI when its data change, let simply provide a generic resync() method to the list widget. The paradigm, here, is that a data provider should always be an array structure whose elements expose a toString() or whatever feature. If the list widget has a reference to some data provider, then it can load and/or resync the list items using always the same abstract routines. Then we have something purely prototypal:
ListBox.prototype.load = DropDownList.prototype.load = function(/*obj[]&*/dp)
// =====================================
// A simple load method based on the assumption that
// all dp items offer a toString() ability
// Manage a reference to the data provider
this.properties||(this.properties={});
this.properties.data||(this.properties.data=[]);
dp?(this.properties.data=dp):(dp=this.properties.data);
// Vars
var CAN_SEP = 'dropdownlist'==this.type,
n = (dp&&dp.length)||0,
i, s;
// Add the ListItem elems
for (
i=0 ;
i < n ;
s=(''+dp[i++]),
this.add(CAN_SEP && '-'==s ? 'separator' : 'item', s)
// One could improve the code to support additional
// keys for: multicol, images, checks, etc.
return this;
ListBox.prototype.resync = DropDownList.prototype.resync = function(/*obj[]&*/dp)
// =====================================
// Resync, or even reload, the data provider items
this.selection = null;
this.removeAll();
return this.load(dp||null);
ListItem.prototype.get = function()
// =====================================
// Return an object instance from the DP (behind this ListItem)
return this.parent.properties.data[this.index] || null;
From that point, what could the client code look like? We basically have two options:
#1 The process is non-modal and then the external object will invoke List.resync(…) when required; in this case it MUST have a reference to the widget.
#2 The process is modal, meaning that the 'external' object in fact is entirely interacted from the UI (e.g. via a button click); in that case no external reference to the list widget is actually required since the UI module itself knows exactly when a List.resync() is required, so why should it delegate the job? Here is a basic example in such a context:
// Let's have some arbitrary 'OOP' stuff available
var MyClass = function(uid,str)
{ // constructor
this.id=uid||0;
this.rename(str||'');
// various methods
MyClass.prototype.rename = function(str){ this.name=str||'<unknown>'; };
// toString()
MyClass.prototype.toString = function(str){ return this.name; };
var myDataProvider = [
// some array of instances
new MyClass(3, "Name 3"),
new MyClass(5, "Name 5"),
new MyClass(7),
new MyClass(11, "Name 11, OK?")
var processChanges = function()
{ // emulate various changes in the data provider
myDataProvider[0].rename("New name (3)");
myDataProvider[2].rename("Finally Born 7");
myDataProvider[myDataProvider.length] = new MyClass(13, "Did you miss 13?");
myDataProvider[myDataProvider.length] = new MyClass(17, "Hello 17");
myDataProvider.splice(1,1);
// Now the User Interface:
var w = new Window('dialog', "Example"),
lb = w.add('listbox').load(myDataProvider),
b = w.add('button', undefined, "Test Changes!");
lb.onDoubleClick = function()
var someInstance = this.selection.get();
alert( "My secret UID is: " + someInstance.id );
b.onClick = function()
processChanges();
lb.resync();
w.show();
Does it make sense?
@+
Marc -
I have such folders structure in my Flex project:
components/classes/
components/modules/
In modules/ folder I have a module (<mx:Module>)
myModule.mxml.
That module imports class myConnector.as from classes/ folder
using statement:
import components.classes.myConnector;
I can work with class' properties and methods and there are
no errors. But when I try to compile myModule.mxml with mxmlc using
command:
mxmlc
pathToProject/components/modules/myModule.mxml
I get an error:
Type was not found or was not a compile-time constant:
myConnector.
private var myConn:myConnector;
As I see compiler cannot locate myConnector.as class, even
though it is located correctly while authoring.
How can specify path to that class for compiler?
Or there is anything else wrong?
Thanks in advance.The answer is yes and no. Since your Modules are not in the
main application directory, the answer is no. Should they live in
the main application directory, then you can mark them as
Applications and Flex Builder will automatically compile them and
move them to the bin directory. -
Hi,
I am trying to implement a simple image gallery with alpha transition using as3. But an issue is occuring with this. After each image alpha transition, the stage becomes blank. The code i have used for image Gallery is following.CAn anybody help me. I am trying this for a week. but still i have a hope for make this working. So please help me.
import flash.display.Loader;
import flash.display.*;
import gs.TweenLite;
const TIMER_DELAY = 2000;
var totImages:Number;
var index:Number = 0;
var imgArr:Array = new Array();
var currentContainer:MovieClip = holder0;
currentContainer.alpha = 0;
var transTimer:Timer = new Timer(TIMER_DELAY);
//transTimer.addEventListener(TimerEvent.TIMER, startTransition);
var imgLoader:Loader = new Loader();
var myXML:XML = new XML();
var XML_URL:String = "images.xml";
var myXMLURL:URLRequest = new URLRequest(XML_URL);
var myLoader:URLLoader = new URLLoader(myXMLURL);
myLoader.addEventListener("complete", xmlLoaded);
function xmlLoaded(event:Event):void{
myXML = XML(myLoader.data);
processXML(myXML);
function processXML(xml){
totImages = xml.children().length();
for(var i=0;i<totImages;i++){
var tempVar = xml..item[i]..image;
imgArr.push(tempVar);
//transTimer.start();
currentContainer = holder0;
loadImage();
function loadImage(){
var url = imgArr[index];
//ImgLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressStatus);
imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, fadeInImg);
var fileRequest:URLRequest = new URLRequest(url);
imgLoader.load(fileRequest);
currentContainer.addChild(imgLoader);
function fadeInImg(e:Event){
TweenLite.to(currentContainer,3,{alpha:1,delay:2,onComplete:switchClip});
function switchClip(){
if(index < totImages){
index++;
} else {
index = 0;
if(currentContainer == holder0){
currentContainer = holder1;
} else {
currentContainer = holder0;
currentContainer.alpha = 0;
MovieClip(this.root).swapChildren(holder0, holder1);
loadImage();
Thanks and Regards,
SreelashHi Adrei, I have implemented the thumbnail button also. Its working but the problem is that thumbnail buttons and controls are placing behind the image container. How can i place the thumbnail buttons and control buttons over the image. You can view the result in the following url:
http://www.creative-showcase.co.uk/BirdStudiosOld/Videos/test/scrllGallAnd.html
The working swf is with the following url:
http://www.creative-showcase.co.uk/BirdStudiosOld/Videos/test/scrllGall.html
The code that i used for creating thumbnail is following
import flash.display.DisplayObject;
import flash.display.*;
import flash.display.Loader;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.events.TimerEvent;
import flash.text.*;
import flash.net.*;
import flash.utils.Timer;
import gs.TweenLite;
import gs.easing.*;
var xmlURL:String = "http://www.creative-showcase.co.uk/BirdStudiosOld/Videos/test1/images.xml";
var loadedImages:Array = [];
var imageURLs:Array = [];
var thumbArr:Array = [];
var imageLoader:Loader;
var prevImage:DisplayObject;
var currentImage:DisplayObject;
var thumbContainer:MovieClip;
var currThumb:MovieClip;
var prevThumb:MovieClip = null;
var showTimer:Timer;
var timerDuration:int = 5000;
var tweenDuration:int = 2;
var currentIndex:int = 0;
var activIndx:Number = 0;
var slidesHolder:Sprite;
var prvFlag:Boolean = false;
var nxtFlag:Boolean = false;
var twnFlag:Boolean = false;
var rt_lt_Flag:Boolean = true;
var myXMLURL:URLRequest = new URLRequest(xmlURL);
var xmlLoader:URLLoader = new URLLoader(myXMLURL);
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
xmlLoader.load(myXMLURL);
var a:int = 90;
ctrlBox.btnPlay.buttonMode = true;
ctrlBox.nextImg.buttonMode = true;
ctrlBox.prevBtn.buttonMode = true;
ctrlBox.btnPause.buttonMode = true;
ctrlBox.btnPlay.visible = false;
ctrlBox.btnPause.addEventListener(MouseEvent.CLICK,stopScroll);
ctrlBox.btnPlay.addEventListener(MouseEvent.CLICK,startScroll);
ctrlBox.nextImg.addEventListener(MouseEvent.CLICK,shwNext);
ctrlBox.prevBtn.addEventListener(MouseEvent.CLICK,shwPrev);
function xmlLoaded(e:Event):void {
var a:int = 45;
e.target.removeEventListener(Event.COMPLETE, xmlLoaded);
processXML(XML(e.target.data));
function processXML(xml:XML):void {
var len:int = xml.children().length();
var tempVar:String;
for (var i:int = 0; i < len; i++) {
tempVar = "http://www.creative-showcase.co.uk/BirdStudiosOld/Videos/test1/" + xml..item[i]..image;
//trace(tempVar)
imageURLs.push(tempVar);
preload();
createThumbs();
function createThumbs():void{
thumbContainer = new MovieClip();
addChild(thumbContainer);
for(var i:int=0;i<9;i++){
var thmbHolder:MovieClip = new MovieClip();
thumbContainer.addChild(thmbHolder);
//MovieClip(this.root).swapChildren(currentImage, ctrlBox);
thmbHolder.buttonMode = true;
var thmb:thumbClass = new thumbClass();
thmbHolder.addChild(thmb);
thumbArr.push(thmbHolder);
thmbHolder.name = i.toString();
thmb.imgNum.text = (i+1).toString();
thmbHolder.addEventListener(MouseEvent.CLICK,showImage)
//trace(thmb.imgNum.text)
thmbHolder.x = i*(thmbHolder.width+5)+5;
thumbContainer.y = stage.stageHeight - thumbContainer.height;
function showImage(e:MouseEvent):void{
var imgIndx:Number = e.target.parent.parent.name;
prevThumb = currThumb;
currThumb = e.target.parent.parent;
currThumb.buttonMode = false;
if(activIndx != imgIndx){
prevThumb.buttonMode = true;
currentIndex = imgIndx-1;
shwNext(null);
activIndx = imgIndx;
} else {
stopScroll(null);
function preload():void{
var len:int = imageURLs.length;
for (var i:int = 0; i < len; i++) {
imageLoader = new Loader();
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onPreloadComplete);
loadedImages.push(imageLoader);
imageLoader.load(new URLRequest(imageURLs[i]));
function onPreloadComplete(e:Event):void {
e.target.removeEventListener(Event.COMPLETE, onPreloadComplete);
if (!showTimer && loadedImages[0].content && loadedImages[1].content ) startShow();
function startShow():void{
currentImage = loadedImages[0];
currentImage.alpha = 0;
slidesHolder = new Sprite();
var slideMask:Sprite = new Sprite();
var gr:Graphics = slideMask.graphics;
gr.beginFill(0xff0000);
gr.drawRect(0, 0, currentImage.width, currentImage.height);
gr.endFill();
addChild(slidesHolder);
addChild(slideMask);
slidesHolder.x = slideMask.x = 0;
slidesHolder.y = slideMask.y = 0;
slidesHolder.mask = slideMask;
slidesHolder.addChild(currentImage);
TweenLite.to(currentImage, 10, { alpha: 1 } );
showTimer = new Timer(timerDuration);
showTimer.addEventListener(TimerEvent.TIMER, slideTransition);
showTimer.start();
function slideTransition(e:TimerEvent):void{
var nextImage:int;
if(rt_lt_Flag == true){
if(nxtFlag == true){
showTimer.stop();
nxtFlag = false;
nextImage = currentIndex < loadedImages.length - 1 ? currentIndex + 1 : 0;
if (loadedImages[nextImage].content) {
currentIndex = nextImage;
loadedImages[currentIndex].x = slidesHolder.width;
slidesHolder.addChildAt(loadedImages[currentIndex], slidesHolder.getChildIndex(currentImage));
prevImage = currentImage;
currentImage = loadedImages[currentIndex];
showCurrent();
} else {
if(prvFlag == true){
showTimer.stop();
prvFlag = false;
nextImage = currentIndex > 0 ? currentIndex - 1 : loadedImages.length - 1;
if (loadedImages[nextImage].content) {
currentIndex = nextImage;
loadedImages[currentIndex].x = -(stage.stageWidth);
slidesHolder.addChildAt(loadedImages[currentIndex], slidesHolder.getChildIndex(currentImage));
prevImage = currentImage;
currentImage = loadedImages[currentIndex];
showCurrent();
activIndx = currentIndex;
//trace(currentIndex)
function showCurrent():void{
// make sure they have proper alphas
//prevImage.alpha = 1;
//currentImage.alpha = 0;
//TweenLite.to(prevImage, tweenDuration, { x: -slidesHolder.width } );
twnFlag = true;
if(rt_lt_Flag == true){
TweenLite.to(currentImage, tweenDuration, { x: 0, onUpdate:onTweenProgress, onComplete: removePrevious } );
} else {
TweenLite.to(currentImage, tweenDuration, { x: 0, onUpdate:onTweenProgress, onComplete: removePrevious } );
function onTweenProgress():void{
if(rt_lt_Flag == true){
prevImage.x = currentImage.x - prevImage.width;
} else {
prevImage.x = currentImage.x + prevImage.width;
function removePrevious():void {
if (slidesHolder.contains(prevImage)) slidesHolder.removeChild(prevImage);
twnFlag = false;
function stopScroll(e:MouseEvent):void{
ctrlBox.btnPlay.visible = true;
ctrlBox.btnPause.visible = false;
showTimer.stop();
function startScroll(e:MouseEvent):void{
rt_lt_Flag = true;
ctrlBox.btnPlay.visible = false;
ctrlBox.btnPause.visible = true;
resetListener(timerDuration=5000,tweenDuration=2)
function shwNext(e:MouseEvent):void{
if(twnFlag == false){
rt_lt_Flag = true;
stopScroll(null);
nxtFlag = true;
resetListener(timerDuration=0,tweenDuration=1)
function shwPrev(e:MouseEvent):void{
if(twnFlag == false){
rt_lt_Flag = false;
stopScroll(null);
prvFlag = true;
resetListener(timerDuration=0,tweenDuration=1)
function resetListener(timerDuration,tweenDuration){
showTimer.removeEventListener(TimerEvent.TIMER, slideTransition);
showTimer = new Timer(timerDuration);
showTimer.addEventListener(TimerEvent.TIMER, slideTransition);
showTimer.start();
Can you help me on how can i swap the depth of images and control buttons.
Thanks and regards,
Sreelash -
Error with flex 4.5.1 using Squiggly
these sample I wrote but give me errors i use flex 4.5.1
i copy it from Squiggly package
what wrong
<?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"
applicationComplete="init()">
<fx:Script>
<![CDATA[
import com.adobe.linguistics.spelling.*;
import mx.controls.textClasses.TextRange;
private var _newdict:HunspellDictionary = new HunspellDictionary() ; // here the first error == -1046: Type was not found or was not a compile-time constant: HunspellDictionary.
private var sp:SpellChecker;
private function init():void {
_newdict.addEventListener(Event.COMPLETE, handleLoadComplete);
_newdict.load("dictionaries/en_US/en_US.aff", "dictionaries/en_US/en_US.dic");
private function handleLoadComplete(evt:Event):void
sp = new SpellChecker(_newdict);
protected function check_clickHandler(event:MouseEvent):void
var wordPattern:RegExp =/\b\w+\b/; // match next word...
var inputValue:String = inputText.text;
var offset:int, curPos:int;
for ( ; ; ) {
var res:Array = inputValue.match( wordPattern); // lookup word by word....
if ( res == null ) break;
if ( !sp.checkWord(res[0]) ) {
offset = inputText.text.length-inputValue.length;
curPos = inputValue.indexOf(res[0]);
var currentRange:TextRange = new TextRange(inputText, false, offset+ curPos, offset+ curPos+res[0].length); // mark mispelled word.
currentRange.color = "red";
inputValue = inputValue.substr(inputValue.indexOf(res[0])+ res[0].length);
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<mx:Button id="check" label="Check Text" click="check_clickHandler(event)" />
<mx:TextArea id="inputText" x="10" y="29" width="945" height="571"/>
</s:Application>i try another code
but give me error : 1120: Access of undefined property SpellUI.
<?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"
creationComplete="init()">
<fx:Script>
<![CDATA[
import com.adobe.linguistics.spelling.*;
private function init():void {
SpellUI.enableSpelling(inputText, "en" );
]]>
</fx:Script>
<mx:TextArea id="inputText" x="10" y="29" width="945" height="571"/>
</s:Application> -
Dynamic Queue names at JMS receiver
HI All,
I have a scenario where sender is an RFC and receiver is via JMS and also get a reply back . JMS is asynchonous but as suggested in other threads it is possible to capture the response by setting some Adapter specific parameters.
But my problem is the queue name for the response is not constant and it varies from request to request for the response. I have no clue how to achieve this , I tried searching some threads but couldn't come to a conclusion.
Possibility of dynamic MQ queue selection in one receiver JMS channel
help on Dynamic queue name in JMS Adapter
Has anyone come across such a situation ? Please suggest.
Also In one of threads it was suggested to use Java Proxy? Please suggest a way forward in this approach too
Regards,
Mohan.> please refer the link what you provided in section 2.8 mentioned JMS Receiver communication channel will give response back,but i never tried.
Yest because this document is applicabe for a scenario where request msg will come form sender JMS to XI and then Response will be sent back again to JMS by using receiver JMS adapter. So senario is JMS request --- R3 (via XI) --- R3 response to JMS.
But here case is different. e.g. RFC --> PI --> JMS and reply will get back from JMS to RFC. So definetly in this case response will come from sender JMS and not from receiver JMS.
Read sec 2.8 throughly, you will come to know how to set the queue names dynamically for RECEIVER JMS Adapter.
Regards,
Sarvesh -
In MTO scenario i want to have some materials with out account assignment
Hi,
In MTO scenario i want to have some components in my BOM to not to get planned with respect to sales order stock / account assignment of specifice sales order( say "C" class items). if i use Consumption based planning" VB" for those
materials it works with manual reorder point planning.but i cannot estimate my correct reorder point for that material.because it is not constant requirement .It varies basing on customer sales order for that period.
My question is how to plan these components in MTO scenario with out having idea of correct manual reorder point for those materials.
thanks in advance
regards
madanMadan,
Automatic Reorder Point Planning
In automatic reorder point planning, both the reorder level and the safety stock level are determined by the integrated forecasting program.
The system uses past consumption data (historical data) to forecast future requirements. The system then uses these forecast values to calculate the reorder level and the safety stock level, taking the service level, which is specified by the MRP controller, and the material's replenishment lead time into account, and transfers them to the material master.
Since the forecast is carried out at regular intervals, the reorder level and the safety stock level are continually adapted to the current consumption and delivery situation. This means that a contribution is made towards keeping stock levels low.
So you need to maintain the forecast view for the material. The forecast values comes from consumption data. If the system in place for some time then consuption data will be automatically by the system based on the material issues. I am not sure if you can enter the consumption manually.
Regards
Ram -
OpenMQ 4.4 b05 nullpointerexception in StompSubscriberSession.onMessage
Hello,
in a test for automatic acknowledge mode, I send a number of messages to the broker and then consume then in two steps, unsubscribing and closing the connection in between.
Sometimes, the server log contains this exception. Maybe it is related to a socket problem (the client closed the socket so the server was not able to send the message)?
INFO: Started JMS connection 1152957546066812160[in] for user admin
21.04.2009 09:23:00
WARNUNG: Unable to deliver message to subscription[{94EED5D7-E09D-4407-A3C9-244D
F197AFEE}]: null
java.lang.NullPointerException
at com.sun.messaging.bridge.service.stomp.StompSubscriberSession.onMessa
ge(StompSubscriberSession.java:110)
at com.sun.messaging.jmq.jmsclient.MessageConsumerImpl.deliverAndAcknowl
edge(MessageConsumerImpl.java:338)
at com.sun.messaging.jmq.jmsclient.MessageConsumerImpl.onMessageToListen
erFromReceiveQueue(MessageConsumerImpl.java:316)
at com.sun.messaging.jmq.jmsclient.SessionReader.onMessageToLateListener
s(SessionReader.java:171)
at com.sun.messaging.jmq.jmsclient.SessionReader.deliver(SessionReader.j
ava:149)
at com.sun.messaging.jmq.jmsclient.ConsumerReader.run(ConsumerReader.jav
a:190)
at java.lang.Thread.run(Unknown Source)
21.04.2009 09:23:00
WARNUNG: Unable to send error message: null
java.lang.NullPointerException
at com.sun.messaging.bridge.service.stomp.StompSubscriberSession.onMessa
ge(StompSubscriberSession.java:134)
at com.sun.messaging.jmq.jmsclient.MessageConsumerImpl.deliverAndAcknowl
edge(MessageConsumerImpl.java:338)
at com.sun.messaging.jmq.jmsclient.MessageConsumerImpl.onMessageToListen
erFromReceiveQueue(MessageConsumerImpl.java:316)
at com.sun.messaging.jmq.jmsclient.SessionReader.onMessageToLateListener
s(SessionReader.java:171)
at com.sun.messaging.jmq.jmsclient.SessionReader.deliver(SessionReader.j
ava:149)
at com.sun.messaging.jmq.jmsclient.ConsumerReader.run(ConsumerReader.jav
a:190)
at java.lang.Thread.run(Unknown Source)
21.04.2009 09:23:00
INFO: Stomp connection 1152957546066812160[in] closed.
21.04.2009 09:23:01This is the (Delphi) code which I am currently testing. The nullpointerexception does not occur in every test run, maybe one out of five.
The test however is also the only one which fails, because the second read does not get all remaining messages everytime. (There should be 10 messages still in the queue). I will try to investigate it further.
Mike
procedure TSendReceiveTests.TestAutoAck;
const
NUM_MSG = 10;
var
Consumer: IMessageConsumer;
Producer: IMessageProducer;
Msg: IMessage;
I: Integer;
begin
Consumer := Session.CreateConsumer(Queue);
// Drain any messages that may allready be in the sub
while Assigned(Consumer.Receive(1000)) do;
Consumer.Close;
Connection.Close;
// send 20 messages
Producer := OutSession.CreateProducer(OutQueue);
// Producer.TimeToLive := 50000;
for I := 1 to 2 * NUM_MSG do
begin
Msg := OutSession.CreateTextMessage;
Msg.JMSCorrelationID := IntToStr(I);
WriteLn('Send ID: ' + Msg.JMSCorrelationID);
Producer.Send(Msg);
end;
OutConnection.Close;
// reopen conn and read 10 messages
CreateInConnection;
Consumer := Session.CreateConsumer(Queue);
for I := 1 to NUM_MSG do
begin
Msg := Consumer.Receive(2000);
if not Assigned(Msg) then
Fail('Received no message (1) ' + IntToStr(I))
else
WriteLn('Receive ID: ' + Msg.JMSCorrelationID);
end;
Consumer.Close;
Connection.Close;
// reopen conn and read 10 messages
CreateInConnection;
Consumer := Session.CreateConsumer(Queue);
for I := 1 to NUM_MSG do
begin
Msg := Consumer.Receive(2000);
if not Assigned(Msg) then
Fail('Received no message (2) ' + IntToStr(I))
else
WriteLn(IntToStr(I) + ' Receive ID: ' + Msg.JMSCorrelationID);
end;
Consumer.Close;
Connection.Close;
end; -
'You have used a feature that requires the Flex SDK'
I've tried this code from a tutorial:
// ActionScript 3.0
* Note: This example assumes the bullet_star.png file
* is in the same directory as your .FLA file.
[Embed("bullet_star.png")]
const BulletStar:Class;
var starIcon:DisplayObject = new BulletStar();
starIcon.x = 10;
starIcon.y = 10;
addChild(starIcon);
When I test it I get this popup:
Does something needs fixing?You're probably better off just making a swc, but if you want to do this you need to implement the Interface that Flash wants with your own version of the Class that Flash is trying to get from the SDK. I think in this case maybe BitmapAsset.
http://stackoverflow.com/questions/9458003/is-there-a-way-to-embed-custom-fonts-in-flash-w ithout-flex
Here's a better link that explains the process better http://blog.brokenfunction.com/2009/03/how-to-remove-flex-libraries-completely-from-your-a s3-project/ -
Flex SDK4 - import built in class error
How are you?
I am writing a very simple class, which I am trying to compile with ./mxmlc found in Flex SDK4. However I am getting the below errors, it seems like the built in classes cannot be found. I am not sure why the FLVPlayback or VideoPlayer or VideoElement components do not get included. I checked the SVN, and I cannot find any reference to these components.
1) All I am trying to do is to get Video to display, using the Flex SDK4 compiler with AS3 files. Why the elements do not import? and What elements could I use for this to work?
package {
import flash.display.Sprite;
import fl.video.FLVPlayback;
public class Welcome extends Sprite {
private var _video:FLVPlayback;
private var _videoPath:String = "InsideJob.f4v";
public function Welcome():void {
build();
protected function build():void {
_video = new FLVPlayback();
_video.play(_videoPath);
var _place = new Position(200, 500);
_video.x = _place.xvalue();
_video.y = _place.yvalue();
stage.addChild(_video)
ERRORS -----
--FLVPlayback
col: 22 Error: Type was not found or was not a compile-time constant: FLVPlayback.
private var _video:FLVPlayback;
col: 17 Error: Call to a possibly undefined method FLVPlayback.
_video = new FLVPlayback();
--Spark
col: 25 Error: Definition spark.components:VideoElement could not be found.
import spark.components.VideoElement;
col: 22 Error: Type was not found or was not a compile-time constant: VideoElement.
private var _video:VideoElement;How are you?
I am writing a very simple class, which I am trying to compile with ./mxmlc found in Flex SDK4. However I am getting the below errors, it seems like the built in classes cannot be found. I am not sure why the FLVPlayback or VideoPlayer or VideoElement components do not get included. I checked the SVN, and I cannot find any reference to these components.
1) All I am trying to do is to get Video to display, using the Flex SDK4 compiler with AS3 files. Why the elements do not import? and What elements could I use for this to work?
package {
import flash.display.Sprite;
import fl.video.FLVPlayback;
public class Welcome extends Sprite {
private var _video:FLVPlayback;
private var _videoPath:String = "InsideJob.f4v";
public function Welcome():void {
build();
protected function build():void {
_video = new FLVPlayback();
_video.play(_videoPath);
var _place = new Position(200, 500);
_video.x = _place.xvalue();
_video.y = _place.yvalue();
stage.addChild(_video)
ERRORS -----
--FLVPlayback
col: 22 Error: Type was not found or was not a compile-time constant: FLVPlayback.
private var _video:FLVPlayback;
col: 17 Error: Call to a possibly undefined method FLVPlayback.
_video = new FLVPlayback();
--Spark
col: 25 Error: Definition spark.components:VideoElement could not be found.
import spark.components.VideoElement;
col: 22 Error: Type was not found or was not a compile-time constant: VideoElement.
private var _video:VideoElement; -
"1046: Type was not found" for a custom class calling a custom class
This should be easy... but I've spent two days on nothing but this error.... I am absolutely at my wit's end.
Basically, I've got a "character" container linked to a MovieClip in the library that is supposed to act as a container for various body parts; head, shirt, pants, etc. For simplicity, I've just got Character class and Head class, both in a "char" package, both classes are named the same as their respective files (Character.as and Head.as, both in an actual file called "char"). Character class is supposed to create an instance of Head, but I always get this 1046 error. The problem is that I've got other body parts with nearly identical classes that ARENT throwing a 1046 error and are working just fine. I went and made a new project to see if I was still having the problem with just character calling 1 simple body part. I do.
In the symbol properties, it's Exported for Actionscript & Export in Frame 1... the class is "char.Head" and "char.Character" respectively. I have tried everything I can find or think of, I've done dozens of Google searches and sifted through dozens of forums. I can't find anything and I've been working on this problem for 24 straight working hours now. I'm completely exasperated......
package char {
import flash.display.MovieClip;
import flash.display.Stage;
import flash.display.Sprite;
import flash.events.Event;
import flash.geom.ColorTransform;
import fl.motion.Color;
import char.Head;
public class Character extends MovieClip {
// 1046: Type was not found or was not a compile-time constant: Head
private var _head:Head;
// reference to get the stage later
private var stageRef:Stage;
public function Character(stageRef:Stage=null) {
trace("NEW CHARACTER");
//1180 Call to a possibly undefined method Head;
_head=new Head();
And here's the contents of Head.as
package char {
import flash.display.MovieClip;
import flash.events.Event;
import flash.display.Stage;
import flash.geom.ColorTransform;
public class Head extends MovieClip {
private var skin_type:uint;
public function Head() {
trace ("NEW HEAD");
Now if I declare the head variable and create a new instance of it in my document class, no problem whatsoever. If I do it in my Character class, it just doesn't stop giving me this error!!! Somebody please help me.
1046: Type was not found or was not a compile-time constant: Head
1180 Call to a possibly undefined method Head;There is a blank movieclip named Character in the library, yup.
Also in my main handler for my document class calls "mainCharacter = new Character(); "
Here's a chunk of the code from the document class. For the record, it calls "head" as just a test and that works fine. Just doesn't work in "Character"
import char.Character;
import char.Head;
public class MainHandler extends MovieClip {
private static var _instance:MainHandler;
public static function get instance():MainHandler { return _instance; }
public var mainCharacter:Character;
public var head_:Head;
public function MainHandler() {
_instance = this;
mainCharacter = new Character();
head_=new Head();
Maybe you are looking for
-
ABAP to delete a specific request (last one) from a Cube
Hello Experts, In a process chain, I would like to delete the last request in a cube before proceeding through with the rest of the PC. For that purpose, I have an ABAP program which will retrieve the "last request ID" from the cube, then call FM RSS
-
While loading the data from XML source I am getting following error ORA-00972: identifier is too long I understand that some of the Column name are more then 30 char (Oracle Limit) inmy source but I like to know what needs to be modified in the IKM t
-
SSID to allow BYOD's and not allow Company PC's accee
I have a WLC 2504 with (2) 3702 AP's. I have successfully set up a SSID (Internal Laptops) for the internal users to connect to the local LAN. I am now trying to create a SSID (Public) for the employees and guest to use their BYOD's. The issue I am
-
Accessing my bank, Firefox keeps giving the above error messages and not responding. Thunderbird is also afflicted with "not responding" I now use Opera which does not have any problems.
-
Is there way to trace all SQL issued by one user? I don't want to turn on tracing for the entire database. I don't have control of the SQL this user issues. I thought of using a logon trigger, but it doesn't allow 'alter session set sql_trace = true;