String to TextData Coercion
I have a question regarding this statement :
Where it can cause inefficiency is:
myTD : TextData = new(); // Do an explicit new
myTD = "Foobar"; // Lose the old TextData and replace
// with the implicit one.
The question is, in the above eg., is the assignment operator 'operator
overloaded' which uses the previous instantiation, or does it cause a
new instantiation all over again.
This is a Forte Software implementation question. So, somebody from
Forte Software Inc. should be able to answer this better. Unless ...
Regards,
Braja.
BRAJA KISHORE CHATTARAJ
Consultant, Analysts International Corporation.
Home : 1801, Williamsburg Road, #41H, Durham, NC 27707
919-403-7296
Email : [email protected]
Get Your Private, Free Email at http://www.hotmail.com
Accepted ! I never knew assignment causes an instantiation.
SetValue() is the safest option. That's the conclusion.
Thanks.
Braja.
----Original Message Follows----
From: [email protected]
To: [email protected],
[email protected]
Date: Fri, 27 Mar 1998 08:00:15 -0600
Subject: Re: string to TextData Coercion
Braja,
Does this answer your question? It prints out "FooBar" and "AAA",
which,
to me, indicates that the assignment causes a new instantiation.
aTD : TextData = New(Value = 'AAA');
bTD : TextData = aTD;
aTD = 'FooBar';
task.lgr.putline(aTD);
task.lgr.putline(bTD);
Dustin Breese
Per-Se Technologies
BRAJA KISHORE CHATTARAJ
Consultant, Analysts International Corporation.
Home : 1801, Williamsburg Road, #41H, Durham, NC 27707
919-403-7296
Email : [email protected]
Get Your Private, Free Email at http://www.hotmail.com
Similar Messages
-
Re: string to TextData Coercion
Braja,
I'm not from Forte, but on the app dev course we discussed this. When you
call your second line, the first myTD object is 'lost' and garbage
collected. To stop this happening rather use
myTD.value = 'Foobar'; // or better still -
myTD.SetValue('Foobar');
Regards
Richard Stobart
Consultant, ECSoft, UK
101 Wigmore Street
London W1H 9AA
(0171) 355 1101
-----Original Message-----
From: braja chattaraj <[email protected]>
To: [email protected] <[email protected]>
Date: 26 March 1998 20:34
Subject: string to TextData Coercion
I have a question regarding this statement :
Where it can cause inefficiency is:
myTD : TextData = new(); // Do an explicit new
myTD = "Foobar"; // Lose the old TextData and replace
// with the implicit one.
The question is, in the above eg., is the assignment operator 'operator
overloaded' which uses the previous instantiation, or does it cause a
new instantiation all over again.
This is a Forte Software implementation question. So, somebody from
Forte Software Inc. should be able to answer this better. Unless ...
Regards,
Braja.
BRAJA KISHORE CHATTARAJ
Consultant, Analysts International Corporation.
Home : 1801, Williamsburg Road, #41H, Durham, NC 27707
919-403-7296
Email : [email protected]
Get Your Private, Free Email at http://www.hotmail.comAccepted ! I never knew assignment causes an instantiation.
SetValue() is the safest option. That's the conclusion.
Thanks.
Braja.
----Original Message Follows----
From: [email protected]
To: [email protected],
[email protected]
Date: Fri, 27 Mar 1998 08:00:15 -0600
Subject: Re: string to TextData Coercion
Braja,
Does this answer your question? It prints out "FooBar" and "AAA",
which,
to me, indicates that the assignment causes a new instantiation.
aTD : TextData = New(Value = 'AAA');
bTD : TextData = aTD;
aTD = 'FooBar';
task.lgr.putline(aTD);
task.lgr.putline(bTD);
Dustin Breese
Per-Se Technologies
BRAJA KISHORE CHATTARAJ
Consultant, Analysts International Corporation.
Home : 1801, Williamsburg Road, #41H, Durham, NC 27707
919-403-7296
Email : [email protected]
Get Your Private, Free Email at http://www.hotmail.com -
Comparing strings that are equal, but If statements saysthey are differ
I've been trying to find why my object is always getting set to a state of
being modified and have found the following method that takes a "string"
passed into it and the attribute that is being compared is also a "string".
The test thinks that they are not equal, but the logMessage shows that the
contents are the same. I've used this same kind of method with other
"strings" and have them working just fine. The version of Forte is 3g and
maybe in a couple of months we will be moving up to version 3.m.2
Any ideas would be helpful, for now, I'm going to take the strings and
assign them to TextData and compare them that way. I know that I've had to
do this before for another object, but I don't understand why it works on
some and not on others.
Thanks, Michael
Method code:
setDefaultText(pDefaultText:string)
tt : Textdata = new;
tt.concat('aDefaultText:|').concat(aDefaultText).concat('|\n');
tt.concat('pDefaultText:|').concat(pDefaultText).concat('|');
logMessage(tt);
if (aDefaultText <> pDefaultText) then
aDefaultText = pDefaultText;
setModified('aDefaultText');
end if;
Output from logMessage:
31-Jul-2000 08:42:10 CHWOReportPrompts aDefaultText:||
pDefaultText:||
! Collect Stable(Pages:8993)->(Pages:6307)
Michael J Schumacher
Systems Analyst
Carlson Hospitality Worldwide - Reservation Center
Phone: 402.491.6195
Fax: 402.498.9166
Email: michael.schumachercarlson.comI took a class in school on file organization and processing which used a book of the same name, and had a section of spell checking algorithms that used a trie. I don't remember the specifics, but it could skip over the current character if it didn't match, and keep processing the rest of the string. One part of the matching was that if there was an extra character, (if you treat words as characters in your example), it would match the rest of the word. The book was by Alan Tharp if you want to try to look it up. That's probably overkill for your problem, but it might give you some inspiration.
-
Possible to iterate attributes?
Is it possible to iterate through the attributes of an object? Or is there a
better
solution for what I want to do?
I have a form for displaying a simple object, and am doing a
query-by-example
type search from this. Unfortunately it's easy to get the form full of 'N/A'
strings
and irritating to clear them, so I'd like to suppress them for the search.
I'd like
to do something like this:
for each attribute do
if attribute is a string or textdata then
if attribute value = 'N/A' then
set attribute value = ''
Any ideas?
Thanks
Chris
Chris Moseley at De Data Ltd
[email protected]
http://www.dedata.com.au
All private email to moz1@ihug please
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>IBC
-----Original Message-----
From: Augusto Jun Devegili [SMTP:[email protected]]
Sent: Monday, July 05, 1999 4:19 AM
To: John Pianezze; Chris Moseley
Cc: [email protected]
Subject: RE: possible to iterate attributes?
At FORUM'99 there was a company which was selling a Reflection framework
(for discovering meta information on classes). Unfortunately I can't recall
its name... :-(
This is going to be solved with SynerJ, though ;-)
-----Original Message-----
From: John Pianezze [mailto:[email protected]]
Sent: Segunda-feira, 5 de Julho de 1999 05:59
To: Chris Moseley
Cc: [email protected]
Subject: RE: possible to iterate attributes?
We all wish !!! Smalltalkers can only laugh.
The class is the only unit in forte that supports any kind of
meta-information. In this case, it's minimal: you can get its class type,
and class type supports one method: AllocInstance().
sigh
What people tend to do to get around it is to build classes that represent
methods.
So for example you might have a class called ApplicationService, which
contains an array of ServiceMethod objects, and each method describes some
kind of operation.
You might define a constant in each method class to describe what it does,
like ServiceMethod.TRANSACTION_NAME, where TRANSACTION_NAME is some constant
string.
Then the only way to figure out how to 'call' the method is by brute force:
so you'l have a big-ass
if-then-elseif-then- elseif-then- elseif-then- elseif-then- elseif-then-
elseif-then-
block of code.
sigh
Alas, this is even how Forte's WebEnterprise maps HTML 'functions' to forte
functionality.
It's messy, but it's worth the effort !!
John Pianezze.
Security First Technologies
-----Original Message-----
From: Chris Moseley [SMTP:[email protected]]
Sent: Monday, July 05, 1999 4:18 PM
To: [email protected]
Subject: possible to iterate attributes?
Is it possible to iterate through the attributes of an object? Or is
there a
better
solution for what I want to do?
I have a form for displaying a simple object, and am doing a
query-by-example
type search from this. Unfortunately it's easy to get the form full
of 'N/A'
strings
and irritating to clear them, so I'd like to suppress them for the
search.
I'd like
to do something like this:
for each attribute do
if attribute is a string or textdata then
if attribute value = 'N/A' then
set attribute value = ''
Any ideas?
Thanks
Chris
Chris Moseley at De Data Ltd
[email protected]
http://www.dedata.com.au
All private email to moz1@ihug please
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive
<URL:http://pinehurst.sageit.com/listarchive/>
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/> -
I'm using Forte to wrap a DLL that communicates to a legacy system. The
communication takes the form of sending and receiving 3000-byte buffers
divided into fixed length fields (the fields are different depending on
which legacy API call is being made). When sending data, I need to fill
in only a handful of fields in the structure with actual data; the rest
of it needs to be filled with spaces. In the C program I'm using as an
example, this is handled with a memset. Is there a Forte equivalent to
the C memset function that I could use to quickly set all characters in
a string (or TextData, or array of char, or something) to have the same
value?
Thanks,
Tim
Tim Kannenberg
Strong Capital Management
[email protected]
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>http://java.sun.com/j2se/1.4.1/docs/api/java/util/Arrays.html
public static void fill(int[] a, int fromIndex, int toIndex, int val)
should take care of that memset problem.
memcpy ? i didn't find exact method, but search the api, maybe System has somethint (i didn't look there)
if you know that iAddress is never more than 255, then you actually don't lose any precision, but the compiler doesn't know that, thats why it is warning you.
BTW:
java.lang.System:
arraycopy(Object src, int srcPos, Object dest, int destPos, int length)
you wellcome -
FW: CommArea Processing Code
I have added the attached project to Forté. Simply do an include public
on the project CommAreaProject. There is no need to reimport it or save
it anywhere.
Let me know if you have any questions.
-----Original Message-----
From: Roger Berlind [SMTP:[email protected]]
<mailto:[SMTP:[email protected]</a>]>
Sent: Thursday, July 16, 1998 2:09 PM
To: Ehrlich, Dave
Cc: [email protected] <mailto:[email protected]>
Subject: CommArea Processing Code
Hi Dave,
Attached is a new pex file, CommAreaProject.pex, which contains the
complete code for dealing with binary comm areas. The class CommArea is
the one from which you should inherit new classes for each CICS
transaction, such as AddAssociationCommArea. As indicated in the code
for the methods PopulateCommArea() and ParseCommArea(), these two
methods must be over-ridden in the subclasses. I've included a sample
subclass called DingDongCommArea to show how this is done. The steps to
follow are:
1) Create a new subclass of CommArea
2) Add whatever attributes you want. It is OK to add an object
attribute, but you must use the attributes of the object when populating
and parsing the buffer; for instance, you could add an attribute
theAssociation of type Association to the AddAssociationCommArea class,
but you would pass values such as theAssociation.Name and
theAssociation.ID to the Append and Extract methods.
3) Drag the methods, PopulateCommArea() and ParseCommArea() from the
CommArea class to your new subclass.
4) In the PopulateCommArea() method of the subclass, put in Append
statements in the order that you want the fields to appear in the
commarea. For strings and TextDatas, you must specify how big the
fields should be. The AppendText() methods will pad these fields with
spaces on the right. You should check for errors after each Append. 0
is returned if successful, -1 if not.
5) In the ParseCommArea() method of the subclass, put in Extract
statements in the order that you expect the fields to be returned. For
strings and TextDatas, you must specify how big the fields should be.
You should check for errors after each Extract. 0 is returned if
successful, -1 if not.
6) I would write a Test() method like the one in the Tester class to
verify that you can populate the comm area and extract out the same data
that you put in.
7) Integrate the new subclass into the repository.
Other developers can now use the subclass comm area in the following
way:
1) They can instantiate a new instance of the subclass.
2) They can assign values to the attributes of the subclass, but not to
the buffer or memStream attributes.
3) They can call PopulateCommArea() to populate the buffer attribute of
the subclass.
4) They can than copy the buffer attribute to an instance of ECI which
will be sent to CICS with the InvokeCICS() method of the service object
CICSMgrSO.
5) They can then copy the commarea returned by CICS back into the buffer
attribute of the subclass.
6) They should then call the ExtractCommArea() method of the subclass.
Note, they should not call ParseCommArea() since this is called from
ExtractCommArea(). I've made ParseCommArea() private so that it cannot
be called from other classes.
Sorry this took so long, but I wanted to test it thouroughly before I
sent it to you.
---Roger <<CommAreaProject.pex>> <<ATT319791.ATT>>sudheer,
If you are using standard idoc then you do not need to create new processing code.
There would be standard processing code available. You need to set input partner profile with processing code.
Let us know which idoc type you are using for inbound posting.
Anyway..TC for Creating processing code is : WE41(Outbound) and WE42 (Inbound)
Nilesh -
Implicit coercion of a value of type String to an unError while Adding Dynamic Rows To Flex DataGrid
Hi friends
I want to add interger for in next next rows while clicking tab button,one i enter all the values in one row if i press tab means next row will be editable.for making that i added the following code.i have some error shows like this
[Bindable]
private var tasks:ArrayCollection;
private static const ADD_TASK:int= "";
private function init():void
tasks = new ArrayCollection();
tasks.addItem(new Task(0.01,100000,0));
tasks.addItem({frmAmount:ADD_TASK});
private function checkEdit(e:DataGridEvent):void
// Do not allow editing of Add Task row except for
// "Click to Add" column
if(e.rowIndex == tasks.length - 1 && e.columnIndex != 0)
e.preventDefault();
private function editEnd(e:DataGridEvent):void
// Adding a new task
if(e.rowIndex == tasks.length - 1)
var txtIn:TextInput =TextInput(e.currentTarget.itemEditorInstance);
var dt:Object = e.itemRenderer.data;
// Add new task
if(parseInt(txtIn.text) != ADD_TASK)
tasks.addItemAt(new Task(parseInt(txtIn.text), 0, ""), e.rowIndex);----->Multiple markers at this line:
-1067: Implicit coercion of a value of type String to an unrelated type int.
-txtIn
// Destroy item editor
commPlanDetGrid.destroyItemEditor();
// Stop default behavior
e.preventDefault();
]]>
Please help if any suggession
Thanks in advance
B.VenkatesanThe error message indicates the problem fairly clearly. _feed_list is defined as a ComboBox in your first line of code. You are passing that as an argument in your populate(_feed_list) line of code. However, the populate function is expecting an XMLList object to be passed, not a ComboBox.
You probably really mean to be using...
populate(feed_items);
since that is the only XMLList to be found -
1067: Implicit coercion of a value of type String to an unrelated type
Hi,
I created a webservice based on sql server 2005 with several methods successfully.
I am having headach now just trying to do some simple tests with Flex :-(
I used the "Import WebService", it created some code "generated webservices".
My test method p_SEARCH_NAME_SOUNDEX is based on a sql procedure wich take a varchar (128) as a parameter => NAL_NOM.
I am just trying to debug this function (error at line in red)
public function searchEntry(name:String):void
// Register the event listener for the findEntry operation.
//agenda.addfindEntryEventListener(handleSearchResult);
myWS.addp_SEARCH_NAME_SOUNDEXEventListener(handleSearchResult);
// Call the operation if we have a valid name.
if(name!= null && name.length > 0)
myWS.p_SEARCH_NAME_SOUNDEX(name);
I got this error message:
067: Implicit coercion of a value of type String to an unrelated type generated.webservices:NAL_NOM_type1.
FLEX has creaetd a type called NAL_NOM_type1 for my class:
* NAL_NOM_type1.as
* This file was auto-generated from WSDL by the Apache Axis2 generator modified by Adobe
* Any change made to this file will be overwritten when the code is re-generated.
package generated.webservices
import mx.utils.ObjectProxy;
import flash.utils.ByteArray;
import mx.rpc.soap.types.*;
* Wrapper class for a operation required type
public class NAL_NOM_type1
* Constructor, initializes the type class
public function NAL_NOM_type1() {}
public var varchar:String;public function toString():String
return varchar.toString();
I tried to do myWS.p_SEARCH_NAME_SOUNDEX(NAL_NOM_type1(name));
and also declared "name" as NAL_NOM_type1... but i still get this error.
This is how it declared my webservice method:
public function p_SEARCH_NAME_SOUNDEX(nAL_NOM:NAL_NOM_type1):AsyncToken
var _internal_token:AsyncToken = _baseService.p_SEARCH_NAME_SOUNDEX(nAL_NOM);
_internal_token.addEventListener("result",_P_SEARCH_NAME_SOUNDEX_populate_results);
_internal_token.addEventListener("fault",throwFault);
return _internal_token;
I am even not on the level of assigning the data to my grid... i just want to see how it gets the data first in debug.
Thanks in advance for you help.
kr,
MetaThanks _Natasha_
I tried this:
var t = new NAL_NOM_type1();
t.varchar = name;
myWS.p_SEARCH_NAME_SOUNDEX(t);
It passes the 1st step :-) but I get another error now :-/
I think it try to get back NAL_NOM_type1 from the server of course on the WSDL side it know only NAL_NOM
Error: Cannot find definition for type 'http://NABSQL64DEV/::NAL_NOM_type1'
at mx.rpc.xml::XMLEncoder/encodeType()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc \xml\XMLEncoder.as:1426]
I guess I have to change my constructor type... i am not used to these stuff :-s
is this generating method the best way to access your data with webservices?
the turorials I saw are xml file or array based... is there any link similar to my issue so I can learn better? -
Linked list to string coercion doesn't use text item delimiters: bug?
set AppleScript's text item delimiters to {"; "} -- well-known technique
{1, -1, "c", "d"} as string -- curly braces specify a vector, delimiters work
-- result: "1; -1; c; d"
{1, -1, "c", "d"} as linked list as string -- if coerced to linked list, delimiters ignored
-- result: "1-1cd"
[1, -1, "c", "d"] as string -- square brackets specify a linked list, delimiters ignored
-- result: "1-1cd"
[1, -1, "c", "d"] as vector as string -- coercing linked list to vector first works
-- result: "1; -1; c; d"Hello
It appears that linked list to string coercion does not respect the AppleScript's text item delimiters which are set to list of Unicode text. (Unicode TIDs have no effects in coercion as if it were set to {""})
I can confirm this behaviour in both AppleScript 1.8.3 (OS9) and 1.9.1 (OSX10.2.8) at hand.
So it has been as such for a long time. Bug I'd call it.
By the way, although this is not the point, linked list is a historical residue and of little use in real scripting. After all, it is much slower than vector with appropriate coding. So we may always coerce it to vector without losing anything.
Regards,
H
Linked list to string coercion & AppleScript's text item delimiters (TIDs).
When AppleScript's TIDs are set to list of Unicode text,
the TIDs have no effect in coercion from linked list to string as if they were set to {""}.
set aa to [1, 2, "a", "b"]
--set aa to {1, 2, "a", "b"} as linked list
set t1 to list2text(aa, ";") -- "1;2;a;b" -- in pre-AppleScript 2.0
set t2 to list2text(aa, ";" as Unicode text) --"12ab"
return {t1, t2}
on list2text(aa, delim)
list aa : source list
string delim : a text item delimiter
return string
local astid, astid0, t
set astid to a reference to AppleScript's text item delimiters
set astid0 to astid's contents
try
set astid's contents to {delim}
--set t to aa as string
--set t to aa as Unicode text
set t to "" & aa
set astid's contents to astid0
on error errs number errn
set astid's contents to astid0
error errs number errn
end try
return t
end list2text -
Error #1034 Type Coercion fail with registerClassAlias and nested Vectors
I'm attempting to use flash.net.registerClassAlias and ByteArray.writeObject in order to serialize/deserialize data with static type information. It works as you'd expect in the general case but I've run into problems with some nested Vectors that I don't understand. Hopefully someone can point out if I'm just missing something.
For what I understand, we must register both the scalar types and a one-deep specification of a Vector for that scalar type in order to use nested Vectors. For example:
flash.net.registerClassAlias("TestStructureInner", TestStructureInner);
flash.net.registerClassAlias("VectorTestInner", Vector.<TestStructureInner> as Class);
This should allow us to read/write objects of type TestStructureInner, Vector.<TestStructureInner>, and Vector.<Vector.<TestStructureInner>> into ByteArrays. And in general it seems to work.
Attached though is a simplified test case that fails, however. The first time we deserialize the data it works. The subsequent time, however, we encounter the following runtime error #1034.
TypeError: Error #1034: Type Coercion failed: cannot convert __AS3__.vec::Vector.<Object>@304fcb9 to __AS3__.vec.Vector.<__AS3__.vec::Vector.<Test0.as$30::TestStructureInner>>.
TypeError: Error #1034: Type Coercion failed: cannot convert __AS3__.vec::Vector.<Object>@304fbc9 to __AS3__.vec.Vector.<__AS3__.vec::Vector.<Test0.as$30::TestStructureInner>>.
TypeError: Error #1034: Type Coercion failed: cannot convert __AS3__.vec::Vector.<Object>@304fdd1 to __AS3__.vec.Vector.<__AS3__.vec::Vector.<Test0.as$30::TestStructureInner>>.
TypeError: Error #1034: Type Coercion failed: cannot convert __AS3__.vec::Vector.<Object>@304fce1 to __AS3__.vec.Vector.<__AS3__.vec::Vector.<Test0.as$30::TestStructureInner>>.
TypeError: Error #1034: Type Coercion failed: cannot convert __AS3__.vec::Vector.<Object>@304fbf1 to __AS3__.vec.Vector.<__AS3__.vec::Vector.<Test0.as$30::TestStructureInner>>.
TypeError: Error #1034: Type Coercion failed: cannot convert __AS3__.vec::Vector.<Object>@304fec1 to __AS3__.vec.Vector.<__AS3__.vec::Vector.<Test0.as$30::TestStructureInner>>.
TypeError: Error #1034: Type Coercion failed: cannot convert __AS3__.vec::Vector.<Object>@304fad9 to __AS3__.vec.Vector.<__AS3__.vec::Vector.<Test0.as$30::TestStructureInner>>.
TypeError: Error #1034: Type Coercion failed: cannot convert __AS3__.vec::Vector.<Object>@304fa61 to __AS3__.vec.Vector.<__AS3__.vec::Vector.<Test0.as$30::TestStructureInner>>.
TypeError: Error #1034: Type Coercion failed: cannot convert __AS3__.vec::Vector.<Object>@304f9e9 to __AS3__.vec.Vector.<__AS3__.vec::Vector.<Test0.as$30::TestStructureInner>>.
TypeError: Error #1034: Type Coercion failed: cannot convert __AS3__.vec::Vector.<Object>@304f971 to __AS3__.vec.Vector.<__AS3__.vec::Vector.<Test0.as$30::TestStructureInner>>.
Re-registering the class aliases again via flash.net.registerClassAlias works in this test case but isn't 100% for our actual application (I'm reticent to even mention it but it seems relevant). Is there a step I'm missing here? Any light shed would be appreciated.
// mxmlc -debug Test0.as
package
import Base64; // http://code.google.com/p/jpauclair-blog/source/browse/trunk/Experiment/Base64/src/Base64.a s
import flash.net.registerClassAlias;
import flash.events.Event;
import flash.utils.ByteArray;
import flash.display.Sprite;
import flash.display.Stage;
import flash.system.System;
public class Test0 extends Sprite
static private const OPERATION_SERIALIZE:uint = 0;
static private const OPERATION_DESERIALIZE_AND_FAIL:uint = 1;
static private const OPERATION_DESERIALIZE_AND_SUCCEED:uint = 2;
static private var staticStage:Stage;
private var bar:Vector.<TestStructure>;
* common functions
static private function registerClassAliases():void
flash.net.registerClassAlias("TestStructureInner", TestStructureInner);
flash.net.registerClassAlias("VectorTestInner", Vector.<TestStructureInner> as Class);
flash.net.registerClassAlias("TestStructure", TestStructure);
static public function staticDeserialize():Object
var byteArray:ByteArray = Base64.decode("EBUAG1Rlc3RTdHJ1Y3R1cmUKEwAHZm9vEAEAH1ZlY3RvclRlc3RJbm5lcgoBEAEABAoBEAEABA oBEAEABAoBEAEABAoBEAEABAoBEAEABAoBEAEABAoBEAEABAoBEAEABA==");
byteArray.position = 0;
return byteArray.readObject();
public function Test0():void
registerClassAliases();
// Switching operation between the constants demonstrates failure/success in a couple of different ways.
// SERIALIZE is just used to prepare the base64 string for subsequent tests.
var operation:int = OPERATION_SERIALIZE_AND_FAIL;
if (operation == OPERATION_SERIALIZE)
trace("Serializing");
// outputs base64 string for subsequent tests
serialize();
else if (operation == OPERATION_DESERIALIZE_AND_FAIL)
trace("Fail case");
// perform successful one deserialization, then one failing one.
deserializeOnceThenFail();
else if (operation == OPERATION_DESERIALIZE_AND_SUCCEED)
trace("Success via re-registration");
// perform successful one deserialization, then another successful one.
deserializeOnceThenSucceed();
* serialize
// outputs base64 string we use for subsequent tests.
private function serialize():void
var baz:Vector.<TestStructure> = new Vector.<TestStructure>;
for (var i:int=0; i<10; ++i)
baz.push(new TestStructure);
var byteArray:ByteArray = new ByteArray;
byteArray.writeObject(baz);
trace(Base64.encode(byteArray));
* deserializeOnceThenFail
// perform successful one deserialization, then one failing one.
public function deserializeOnceThenFail():void
// save stage
staticStage = stage;
// the first deserialize will proceed without error.
staticDeserialize();
trace("Successful deserialize");
// add an event listener in order to invoke error on subsequent frame
stage.addEventListener(Event.ENTER_FRAME, doEnterFrameOnceThenFail);
// remove event listener and invoke again.
static private function doEnterFrameOnceThenFail(e:Event):void
staticStage.removeEventListener(Event.ENTER_FRAME, doEnterFrameOnceThenFail);
staticDeserialize();
trace("unsuccessful deserialize2");
* deserializeOnceThenSucceed
* Here, we re-call flash.net.registerClassAlias on all our class types when running.
// perform successful one deserialization, then one failing one.
public function deserializeOnceThenSucceed():void
// save stage
staticStage = stage;
// the first deserialize will proceed without error.
staticDeserialize();
trace("Successful deserialize");
// add an event listener in order to invoke error on subsequent frame
stage.addEventListener(Event.ENTER_FRAME, doEnterFrameOnceThenSucceed);
// remove event listener and invoke again.
static private function doEnterFrameOnceThenSucceed(e:Event):void
staticStage.removeEventListener(Event.ENTER_FRAME, doEnterFrameOnceThenSucceed);
registerClassAliases();
staticDeserialize();
trace("successful deserialize2");
internal class TestStructureInner
public var value:int;
internal class TestStructure
public var foo:Vector.<Vector.<TestStructureInner>> = new Vector.<Vector.<TestStructureInner>>;The error would imply that ImageAssetEvent does not inherit
DisplayEvent. Either modify the inheritance chain or listen for a
basic Event object (flash.events.Event) and cast inside the
function. -
How can i write a sign string in VISA Write?
Hello everybody.
I would like someone to help me. I have an
array, which is transformed (by Byte Array to String) in a string that
reaches the VISA Write Serial Port. My problem is that when making the
transformation with Byte Array to String, i lose all the bytes with sign
(negative).
What can I do? I don't want to lose the sign bytes and be able to send them to VISA Write Serial Port.
Thank you very much.It sounds like you have a typecasting problem. First, why do some of your bytes have a sign? I assume they are I8. Strings are based on U8 because they are just a series of ASCII characters vs. values. The ASCII character table goes from 0 to 255.
What happens on the other end of the VISA communication string?
One thing you could do is to typecast your bytes to a U8. Though I think the coercion dot of an I8 byte array going into the byte array to string is doing this automatically. -
Implicit coercion Error while Adding Dynamic Rows To Flex DataGrid
Hi friends
I want to add interger for in next next rows while clicking tab button,one i enter all the values in one row if i press tab means next row will be editable.for making that i added the following code.i have some error shows like this
[Bindable]
private var tasks:ArrayCollection;
private static const ADD_TASK:int= "";
private function init():void
tasks = new ArrayCollection();
tasks.addItem(new Task(0.01,100000,0));
tasks.addItem({frmAmount:ADD_TASK});
private function checkEdit(e:DataGridEvent):void
// Do not allow editing of Add Task row except for
// "Click to Add" column
if(e.rowIndex == tasks.length - 1 && e.columnIndex != 0)
e.preventDefault();
private function editEnd(e:DataGridEvent):void
// Adding a new task
if(e.rowIndex == tasks.length - 1)
var txtIn:TextInput =TextInput(e.currentTarget.itemEditorInstance);
var dt:Object = e.itemRenderer.data;
// Add new task
if(parseInt(txtIn.text) != ADD_TASK)
tasks.addItemAt(new Task(parseInt(txtIn.text), 0, ""), e.rowIndex);----->Multiple markers at this line:
-1067: Implicit coercion of a value of type String to an unrelated type int.
-txtIn
// Destroy item editor
commPlanDetGrid.destroyItemEditor();
// Stop default behavior
e.preventDefault();
]]>
Please help if any suggession
Thanks in advance
B.VenkatesanVenktesan,
You are trying compare String and int..! which is not possible try to case the txtIn.text to int using parseInt(txtIn.text).
ORIGINAL:
if(txtIn.text != ADD_TASK).---->error : Comparison between a value with static type String and a possibly unrelated type int
tasks.addItemAt(new Task(txtIn.text, 0, ""), e.rowIndex);----> error:Implicit coercion of a value of type String to an unrelated type int.
EDITED:
if(parseInt(txtIn.text) != ADD_TASK).---->error : Comparison between a value with static type String and a possibly unrelated type int
tasks.addItemAt(new Task(parseInt(txtIn.text), 0, ""), e.rowIndex);----> error:Implicit coercion of a value of type String to an unrelated type int.
Thanks
Pradeep -
AS3: Classes, subclasses and "implicit coercion"
Hi.
I have created several custom classes:
- Category, containing a string with the category's name.
- SubCategory, extends Category.
- CategoryList, containing an array of Category instances and
a function getCategoryByName.
- SubCategoryTracer, with a function subTrace that traces the
name of a given SubCategory.
When I use subTrace, if the argument is a direct SubCategory,
it works fine, but if it's the result of getCategoryByName, even
when it does return a SubCategory object, I get the following
error:
1118: Implicit coercion of a value with static type
tests:Category to a possibly unrelated type tests:SubCategory.
How can I get this to work? Thanks in advance.1. I guess you need to change the code to the following (read the comments):
// Creates an object from the class called mySample
var externalFile:mySample = new mySample();
// allows the program to read the text box as a number
* these two lines DO NOT read text field values when they change
* so these two vars are useless unless you want to retain original values
var num1 = Number(txtBox1.text)
var num2 = Number(txtBox2.text)
//Button event listener
btnCalc.addEventListener(MouseEvent.CLICK, clickHandler);
function clickHandler(e:MouseEvent):void
// read textfields' values every time user clicks the button
resultTextBox.text = String(externalFile.addNumbers(Number(txtBox1.text), Number(txtBox2.text)));
2. You need to get into a habit to strictly type you variables and objects.
3. You should get into a habit to declare variable namespace (private, public, etc.) of the variables. SO you class variables declarations should be:
private var num1:Number;
private var num2:Number;
private var answer:Number;
4. It is wise to name classes starting with upper case - it is a convention that makes AS programmer life easier.
5. Since your class has no other task but calculate and return new value - declaring additional calss level variables (num1, num2, and answer) introduces an unnecessary overhead. These variables existence would be justified only if they were reused.
I suggest your class should be like that (note that addNumber method's parameters are typed to Number):
package
public class MySample
//create a function
public function addNumbers(num1:Number, num2:Number):Number
return num1 + num2; //this function returns something that can be used elsewhere -
New user with an massive array/string headache
Working with a large (365 source files, 65 mxml files) SDK 3.6.0 project in FB 4.5 and continually get :
Resource
Path
Location
Description
Type
TB4.mxml
/the0bot_1/src/the0bot/gui
line 1
1067: Implicit coercion of a value of type String to an unrelated type Array.
Flex Problem
TB4.mxml
/the0bot_1/src/the0bot/gui
line 1
1184: Incompatible default value of type String where Array is expected.
Flex Problem
It is a very strange error, as you can see, line #1 is my language declaration!
<?xml version="1.0" encoding="utf-8"?>
This error is virtually non-removable. It usually attaches to a component, or an ArrayCollection, and even if I delete the accused violator, the error will find a new point of attachment.? This is the only page in the project that involves two-way data binding. I had at first attributed the error to a yahoo.astra.com timestepper drop-in, but even rebuilding the page without that component does not remedy the trouble....
Any help at this point would be appreciated, There are countless hours invested in the project and this has been a hold-up for several days now.
Thank you.Nothing had changed project-wise originally. I am simply adding a new mxml component to a perfectly good runnable project. I have since moved my workspace twice to a clean folder, and if I remove the module everything is back to normal.
I do notice that it won't show up if I have a normal error (i.e add a visual component but have not added code yet or forget a brace or such) but then when I clear the last error and validate, the cursor will jump to the top of the page mmediately.
currently the errors are
Resource
Path
Location
Description
Type
TB4.mxml
/the0bot_1/src/the0bot/gui
line 296
1067: Implicit coercion of a value of type String to an unrelated type Array.
Flex Problem
TB4.mxml
/the0bot_1/src/the0bot/gui
line 296
1184: Incompatible default value of type String where Array is expected.
Flex Problem
(they have moved off the header to the reinstalled numberformatter)
the code:
Some may seem a little unconventional, but I have been getting strange errors like
Resource
Path
Location
Description
Type
TB4.mxml
/the0bot_1/src/the0bot/gui
line 222
1105: Target of assignment must be a reference value.
Flex Problem
which is why the 2 " tbean(t) = n; " lines are commented out. ( tbean = object, t = string, n = number)???
(all the bindings are an attempt at elimination....)
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:gui="the0bot.gui.*"
width="418" height="289">
<mx:Script>
<![CDATA[
import com.evony.common.beans.*;
import com.evony.common.constants.*;
import com.google.analytics.debug._Style;
import flash.events.*;
import flash.utils.*;
import mx.collections.ArrayCollection;
import mx.controls.Button;
import mx.events.*;
import mx.events.ItemClickEvent;
import mx.events.PropertyChangeEvent;
import mx.utils.ObjectUtil;
import the0bot.common.*;
import the0bot.event.CityManagerUpdateEvent;
import the0bot.management.*;
import the0bot.management.CityManager;
import the0bot.player.*;
import the0bot.scripts.*;
private var cityManager:CityManager;
private var city:CityState;
public var _THE0BOT:String = "the0bot";
public var the0bot:Boolean;
public static const yes:Boolean = true;
public static const no:Boolean = false;
public static const zero:int = 0;
public static const resource:Array = ("food", "wood", "stone", "iron", "gold");
[Bindable]public var text:String;
[Bindable]public var value:Number;
[Bindable]public var tb2Heroes:ArrayCollection;
[Bindable]public var tb2Troops:ArrayCollection;
[Bindable]public var tb3Queue:ArrayCollection;
[Bindable]public var tb2Resources:ArrayCollection;
[Bindable]public var tb2Cities:ArrayCollection;
[Bindable]public var selectedIndex:int;
[Bindable]public var selectedCity:String;
[Bindable]public var selectedHero:String;
[Bindable]public var selectedtb3:String;
// Rom
public function init(citymanager:CityManager,City:CityState) : void {
cityManager = citymanager;
city=City;
the0bot = (this.cityManager.getConfig(_THE0BOT, 0));
resettb2Data();
listCities;
cityManager.addEventListener(CityManagerUpdateEvent.TYPE, onUpdate);
Context.getInstance().addEventListener(PropertyChangeEvent.PROPERTY_CHANGE, onContexthandler);
Context.getInstance().addEventListener(CityManagerUpdateEvent.TYPE, onUpdate);
Refresh();
public function unInit() : void {
if (cityManager.hasEventListener(CityManagerUpdateEvent.TYPE))
cityManager.removeEventListener(CityManagerUpdateEvent.TYPE, onUpdate);
if (Context.getInstance().hasEventListener(CityManagerUpdateEvent.TYPE))
Context.getInstance().removeEventListener(CityManagerUpdateEvent.TYPE, onUpdate);
cityManager = null;
public function Refresh() : void {
this.callLater(updateHeroes);
[Bindable]private var travelTime:Number;
[Bindable]private var campTime:Number;
private function onContexthandler(event:PropertyChangeEvent) : void
campTime = (Number(campMinutes.text)* 60000) + campSeconds.value * 1000;
var t =(Utils.getServerTime() + travelTime + campTime)as Date;
_arriveClock.text = TFseconds.format(t);
(xSpin.value >= 800)? xSpin.value=0 : (xSpin.value <= -1)? xSpin.value = 799 :t=null;
(ySpin.value >= 800)? ySpin.value=0 : (ySpin.value <= -1)? ySpin.value = 799 :t=null;
private function onUpdate(event:CityManagerUpdateEvent) : void {
if (event.CastleId == cityManager.id || event.CastleId == -1) {
switch (event.UpdateType) {
case CityManagerUpdateEvent.TROOPS:
case CityManagerUpdateEvent.PRODUCTION:
Refresh();
break;
private function updateHeroes():void
if (heroMenu.selectedIndex != zero) return;
tb2Heroes.disableAutoUpdate();
tb2Heroes = new ArrayCollection;
for each (var hero:HeroBean in cityManager.heroes){
if (hero.isIdle == yes){
var obj:Object = new Object;
obj.label = hero.name;
tb2Heroes.addItem(obj);
obj = {label:"any"};
tb2Heroes.addItemAt(obj, 0);
obj = {label:"none"};
tb2Heroes.addItemAt(obj, 0);
tb2Heroes.enableAutoUpdate();
heroMenu.selectedIndex = zero;
public function resettb2Troops() : void
var tb2:Array = new Array();
for (var t:int = 0; t < TroopType.justTroopIntNames.length-1; t++ )
tb2[t].label = TroopType.justTroopAbbr[t];
tb2[t].data = 0;
tb2[t].type = TroopType.justTroopIntNames[t];
tb2Troops = new ArrayCollection(tb2);
private function resettb2Resources():void
var tb2:Array = new Array;
for (var i:int = 0; i < resource.length-1; i++);
tb2.label = resource[i].charAt(0) + ":";
tb2.data = 0;
tb2.type = resource[i];
tb2Resources = new ArrayCollection(tb2);
private function listCities():void{
tb2Cities = new ArrayCollection;
for each (var gcity:CityState in Context.getInstance().cities){
var obj:Object = new Object;
obj.label = gcity.cityManager.castle.name;
obj.id = gcity.cityManager.castle.fieldId;
(obj.id == this.cityManager.castle.fieldId) ? tb2Cities.addItemAt(obj, zero) : tb2Cities.addItem(obj);
private function resettb2Data():void
resettb2Troops()
resettb2Resources()
updateHeroes();
listCities();
public function doesHaveEnsign(): Boolean {
var player:* = Context.getInstance().Player;
for each (var item:* in player.itemsArray) {
if (item.id == null) continue;
if (item.id == "player.troop.1.a") return true;
return false;
protected function campSwitchClick(event:MouseEvent):void
/* if (campSwitch.selected = yes) arriveSwitch.selected = no;
else {campMinutes.text = "0";
campSeconds.value=0;
protected function arriveSwitchClick(event:MouseEvent):void
if (arriveSwitch.selected = yes){
campSwitch.selected = no;
travelTime=0;
else travelTime = getArmyMarchTime();
public function tb2troopsToBean():TroopBean{
var tbean = new TroopBean;
var tb2:Array = tb2Troops.toArray()
for (var i:int = 0; i < tb2.length-1; i++ )
var n:Number = tb2[i].data;
var t:String = tb2[i].type;
//tbean(t) = n;
return tbean;
public function tb2resToBean():ResourceBean{
var tbean = new ResourceBean;
var tb2:Array = tb2Resources.toArray();
for (var i:int = 0; i < tb2.length-1; i++ )
var n:Number = tb2[i].data;
var t:String = tb2[i].type;
//tbean(t) = n;
return tbean;
private function spinCoordsString():String
return xSpin.value + "," + ySpin.value;
private function missionTypeIndex():int
var s:int=marchMenu.selectedIndex+1;
if (s==4)s++;
return s;
private function spinnersToFieldID():int{
return (int(ySpin.value)*800 + int(xSpin.value));
private function fieldIDtoSpinners(fieldID:int):void
xSpin.value = Map.getX(fieldID);
ySpin.value = Map.getY(fieldID);
public function getArmyMarchTime():Number{
return cityManager.getAttackTravelTime(this.cityManager.id, spinnersToFieldID(), tb2troopsToBean(), missionTypeIndex());
protected function xySpin_changeHandler():void
protected function sendSwitchClick(event:MouseEvent):void
var t:TroopBean = tb2troopsToBean();
var r:ResourceBean = tb2resToBean();
var camp:String = "";
var time:String = campMinutes.text + ":" + campSeconds.textSnapshot;
camp += (arriveSwitch.selected) ? "@:" + time : (campSwitch.selected) ? "c:" + time : "";
if (!useEnsignSwitch.selected == yes)
this.city.sendTroops(spinCoordsString(), TroopType.troopBeanToString(t,","), missionTypeIndex(), heroMenu.text, r, camp);
else this.city.sendBigTroops(spinCoordsString(), TroopType.troopBeanToString(t,","), missionTypeIndex(), heroMenu.text, r, camp);
heroMenu.selectedIndex = zero;
updateHeroes();
protected function citycloseHandler(event:FlexEvent):void
for each (var gcity:CityState in Context.getInstance().cities){
if (gcity.cityManager.castle.name == cityMenu.selectedLabel){
fieldIDtoSpinners(gcity.cityManager.castle.fieldId);
private function herocloseHandler(event:Event):void {
selectedHero = ComboBox(event.target).selectedItem.label;
]]>
</mx:Script>
<mx:DateFormatter id="TFseconds" formatString="J:NN:SS"/>
<mx:HBox width="415" height="288" horizontalGap="5" horizontalScrollPolicy="off" paddingTop="5"
verticalScrollPolicy="off">
<mx:VBox width="277" height="280" horizontalAlign="center" horizontalScrollPolicy="off"
verticalGap="4" verticalScrollPolicy="off">
<mx:HBox x="0" y="0" height="276" horizontalGap="5" paddingLeft="5" paddingTop="3">
<mx:VBox height="267" horizontalScrollPolicy="off" paddingTop="5" verticalGap="4"
verticalScrollPolicy="off">
<mx:HBox id="troopCountBox" width="125" height="25" borderColor="#2B1296"
borderStyle="solid" borderThickness="2" cornerRadius="5"
horizontalAlign="center" horizontalGap="0" horizontalScrollPolicy="off"
verticalScrollPolicy="off">
<mx:Label width="37" paddingTop="2" text="Army" textAlign="center"/>
<mx:Text width="70" paddingTop="2" text="125,000" textAlign="left"/>
</mx:HBox>
<mx:DataGrid id="table1" width="125" height="226" backgroundAlpha=".1"
backgroundColor="#EADFF2" borderColor="#400AAF" borderStyle="solid"
borderThickness="2" dataProvider="{tb2Troops}"
lockedColumnCount="2" lockedRowCount="12"
resizableColumns="false" rowHeight="20" selectionMode="singleCell"
showHeaders="false" sortableColumns="false"
variableRowHeight="false">
<mx:columns>
<mx:DataGridColumn width="35" dataField="abbr" editable="false"
fontSize="10"/>
<mx:DataGridColumn width="90" dataField="data" editable="true"
editorDataField="value" fontSize="10"
formatter="{nf}"
itemEditor="mx.controls.NumericStepper"/>
</mx:columns>
</mx:DataGrid>
</mx:VBox>
<mx:VBox width="131" height="268" horizontalAlign="center" paddingTop="5" verticalGap="4">
<mx:HBox width="125" height="25" borderColor="#2B1296" borderStyle="solid"
borderThickness="2" cornerRadius="5" horizontalAlign="center" horizontalGap="0"
horizontalScrollPolicy="off" verticalScrollPolicy="off">
<mx:Label width="31" paddingLeft="0" paddingRight="0" paddingTop="2" text="Res."
textAlign="right"/>
<mx:Text width="80" paddingTop="2" text="999,999,999" textAlign="left"/>
</mx:HBox>
<mx:DataGrid id="table2" width="125" height="139" allowMultipleSelection="false"
backgroundAlpha=".1" backgroundColor="#DBE4F5" borderColor="#400AAF"
dataProvider="{tb2Resources}" lockedColumnCount="2" lockedRowCount="5"
resizableColumns="false" rowHeight="20" selectionMode="singleCell"
showHeaders="false" sortableColumns="false" variableRowHeight="false">
<mx:columns>
<mx:DataGridColumn width="35" dataField="abbr" editable="false"
fontSize="10" headerText="Type" textAlign="right"/>
<mx:DataGridColumn dataField="data" editable="true"
editorDataField="value" fontSize="10" formatter="nf"
headerText="Amt." textAlign="right">
<mx:itemEditor>
<mx:Component>
<mx:NumericStepper doubleClickEnabled="true"
maximum="{resMax()}"
stepSize="1"/>
</mx:Component>
</mx:itemEditor>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
<mx:HBox horizontalScrollPolicy="off" verticalAlign="middle"
verticalScrollPolicy="off">
<mx:Label width="33" height="19" text="Arr:" textAlign="right"/>
<mx:Text id="_arriveClock" width="76" height="21" paddingLeft="2" paddingTop="1"
text="00:00:00" textAlign="left"/>
</mx:HBox>
<mx:HBox width="84" horizontalGap="0" horizontalScrollPolicy="off" verticalScrollPolicy="off">
<mx:TextInput id="campMinutes" width="23" fontWeight="bold" maxChars="3"
restrict="0-9" text="00" textAlign="right"/>
<mx:Text width="7" fontWeight="bold" selectable="false" text=":"
textAlign="right"/>
<mx:NumericStepper id="campSeconds" width="49" fontWeight="bold" maximum="59" value="" textAlign="left"/>
</mx:HBox>
<mx:ComboBox id="marchMenu" width="100" editable="false" fillColors="black,blue"
textAlign="center">
<mx:dataProvider>
<mx:Array>
<mx:String>transport</mx:String>
<mx:String>reinforce</mx:String>
<mx:String>scout</mx:String>
<mx:String>attack</mx:String>
</mx:Array>
</mx:dataProvider>
</mx:ComboBox>
</mx:VBox>
</mx:HBox>
</mx:VBox>
<mx:HBox width="125" height="280" borderColor="#400AAF" borderStyle="solid"
borderThickness="2" cornerRadius="5" horizontalGap="3" horizontalScrollPolicy="off"
paddingLeft="4" paddingTop="4" verticalScrollPolicy="off">
<mx:VBox width="115" height="269" horizontalAlign="center" horizontalScrollPolicy="off"
verticalGap="5" verticalScrollPolicy="off">
<mx:RadioButton id="useEnsignSwitch" width="65" label="Ensign"/>
<mx:HBox width="100%" height="27" borderColor="#3F2AC1" borderStyle="solid"
borderThickness="2" cornerRadius="5" horizontalAlign="center"
verticalAlign="middle">
<mx:Button id="editSwitch" width="45" height="20" label="Edit" enabled="false"
paddingLeft="1" paddingRight="1" toggle="true"/>
<mx:Button id="FMJSwitch" width="45" height="20" label="F.M.J."
click="campSwitchClick(event)" enabled="false" paddingLeft="1"
paddingRight="1" selected="true" toggle="true"/>
</mx:HBox>
<mx:ComboBox id="tb3Menu" width="100" dataProvider="{tb2Heroes}" editable="false"
close="tb3closeHandler(event)" fillColors="black,blue" selectedIndex="0"
textAlign="center">
</mx:ComboBox>
<mx:ComboBox id="cityMenu" width="100" dataProvider="{tb2Cities}" editable="false"
close="citycloseHandler(event)" fillColors="black,blue" selectedIndex="0"
textAlign="center">
</mx:ComboBox>
<mx:ComboBox id="heroMenu" width="100" dataProvider="{tb2Heroes}" editable="false"
close="herocloseHandler(event)" fillColors="black,blue" selectedIndex="0"
textAlign="center">
</mx:ComboBox>
<mx:HBox width="100" height="28" horizontalAlign="center" horizontalGap="0" paddingBottom="0"
paddingLeft="0" paddingRight="0" paddingTop="0" verticalAlign="middle">
<mx:Label text="X:"/>
<mx:NumericStepper id="xSpin" width="55" change="xySpin_changeHandler(event)"
maximum="800" minimum="-1" value="0"/>
</mx:HBox>
<mx:HBox width="100" height="28" horizontalAlign="center" horizontalGap="0"
horizontalScrollPolicy="off" paddingBottom="0" paddingLeft="0" paddingRight="0"
paddingTop="0" verticalAlign="middle" verticalScrollPolicy="off">
<mx:Label text="Y:"/>
<mx:NumericStepper id="ySpin" width="55" change="xySpin_changeHandler(event)"
maximum="800" minimum="-1" value="0"/>
</mx:HBox>
<mx:HBox width="108" height="26" borderColor="#3F2AC1" borderStyle="solid"
borderThickness="2" cornerRadius="5" horizontalAlign="center"
horizontalScrollPolicy="off" verticalAlign="middle" verticalScrollPolicy="off">
<mx:Button id="sendSwitch" width="45" height="22" label="Send" borderColor="#60C592"
click="sendSwitchClick(event)" paddingLeft="1" paddingRight="1"/>
<mx:Button id="clearSwitch" width="54" height="22" label="Clear"
click="clearSwitch_clickHandler(event)"/>
</mx:HBox>
<mx:HBox width="100%" height="27" borderColor="#3F2AC1" borderStyle="solid"
borderThickness="2" cornerRadius="5" horizontalAlign="center"
verticalAlign="middle">
<mx:Button id="arriveSwitch" width="45" height="20" label="Arrive" enabled="true"
paddingLeft="1" paddingRight="1" toggle="true"/>
<mx:Button id="campSwitch" width="45" height="20" label="Camp"
click="campSwitchClick(event)" enabled="true" paddingLeft="1"
paddingRight="1" selected="true" toggle="true"/>
</mx:HBox>
</mx:VBox>
</mx:HBox>
</mx:HBox>
</mx:Canvas> -
Hello, i've a class named LoadImages with the code:
package
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.display.Loader;
public class LoadImages extends MovieClip
private var _root:MovieClip=new MovieClip();
public function LoadImages(numImages:Number, rt:MovieClip)
and i've a second class named MainJogo that call's LoadImages:
package
import flash.events.*;
import flash.display.Loader;
import flash.display.MovieClip;
import flash.display.Stage;
import LoadImages;
public class MainJogo
#error
private var imgMc:LoadImages=new LoadImages(2,this);
#error
public function MainJogo(url:String)
if i just post the MainJogo class code in TimeLine there is no problems but if i run the app like this with 2 classes i keep getting the error
1067: Implicit coercion of a value of type Class to an unrelated type flash.display:MovieClip.
Can someone help me please?
thanksMainJogo is not a Movieclip so "this" (in the scope of MainJogo) is not a MovieClip.
if MainJogo did extend the movieclip class, you would probably still need to cast "this" as a MovieClip.
you could use:
package
import flash.events.*;
import flash.display.Loader;
import flash.display.MovieClip;
import flash.display.Stage;
import LoadImages;
public class MainJogo extends MovieClip
private var imgMc:LoadImages=new LoadImages(2,MovieClip(this));
public function MainJogo(url:String)
Maybe you are looking for
-
Okay, so, I just found my Ipod today after it has been lost for two months. It was under my recliner in my living room. Both buttons are functional and work and it charges just fine. However, there's one big vicious crack near the bottom left corner.
-
How I Got Boxee Working On A New Arch Install -- 3/12/2011
I thought I'd post a log of how one gets boxee-source working as of version 0.9.23.15885-2. I recently built myself a new media center/apache server/seedbox and thought I would put arch on it. The Install was a breeze --- as far any arch install is
-
Flash video - YouTube/ iPlayer does not fit my secondary display, please help
For the last few weeks, everytime I try and play video such as in iPlayer or YouTube on my secondary (1920x1080 Samsung TV 40") monitor, from my MacBook Pro 15" (New Thunderbolt version) it has a border and does not fill the screen. The YouTube divx
-
Hp 15-r007 tx pc = i need 3d video controller driver plz help me
i had downloaded drivers from your official web site 3d video controller driver is missing can provied link to downlaod plz help...
-
AS 3.0 Output Error for Start / Stop Buttons
In trying to understand ActionScript 3.0 mouse events, I have followed the online video under Flash / ActionScript / Getting Started wit ActionScript 3.0 presented by Justin Everett-Church. At least I don't see any syntax errors. I am not getting a C