Note that there are some explanatory texts on larger screens.

plurals
  1. POError #1034: Type Coercion failed: cannot convert __AS3__.vec::Vector.<com.clark::searchVO1>$ to __AS3__.vec.Vector.<com.clark::searchVO1>
    primarykey
    data
    text
    <p>I want to first start off asking if anyone has any suggestions of any resource(books or examples) on parsing data/or Sessioning variables in AS3. I researched for some resources but those books or sites, does not really cover the topics i mentioned.</p> <p><strong>I am trying to parse some JSON data from php into AS3 VO, then the VO into Vector file, the Vector File put the data into boxes, and that sits inside another as file for display. The boxes split the results into specific data. For example Box 1(ID1, Name1, Location1). Box 2(ID2,Name2,Location2). When the specific box is hit, the box will session the ID of that Box(listing), then parse it so it goes to the next AS file(to pull out the details from database) to display the details of that specific Listing.</strong></p> <p>With the help from other post&amp;poster, i managed to get to parsing the JSON back, but i have 2 errors, because i don't know which Valid vector i need to put as the parameter. And can i have some idea/advice on how i should create the "Sessioning ID" when the box is clicked?</p> <blockquote> <p>Error #1034: Type Coercion failed: cannot convert <strong>AS3</strong>.vec::Vector.$ to <strong>AS3</strong>.vec.Vector.. At this line <code>var s3:SearchVectorTest= new SearchVectorTest(Vector.&lt;searchVO1&gt;);</code> in the file sresultnologin below. Error #1069: Property 0 not found on com.clark.SearchVectorTest and there is no default value. Starting from this line <code>mySearchVector[i].nobed = searchVOs[i].nobed;</code> in the searchVO1 file below Thanks for your time. SearchVO1</p> </blockquote> <pre><code>package com.clark { import flash.display.MovieClip; import flash.events.Event; import flash.events.MouseEvent; import flash.display.Stage; import fl.controls.Button; import flash.net.URLLoader; import flash.net.URLRequest; import flash.net.URLRequestMethod; import flash.net.URLLoaderDataFormat; import flash.net.URLVariables; import flash.utils.*; import flash.sampler.NewObjectSample; public class searchVO1 extends MovieClip { private var Arvariables:URLVariables; private var SrSend:URLRequest; private var SaLoader:URLLoader; public var nobed:String; public var zip:String; public var Location:String; public var price:String; public var callMethod:Function; public var s1:searchpage = new searchpage (); public function searchVO1():void{ addEventListener(Event.ADDED_TO_STAGE, onadded); // init function onadded (event:Event):void{ s1.x=-10; s1.y=10; addChild(s1); s1.searchs.addEventListener(MouseEvent.CLICK, ValidateAndsearch); // Build the varSend variable SrSend = new URLRequest("http://localhost/search.php"); SrSend.method = URLRequestMethod.POST; Arvariables = new URLVariables; SrSend.data = Arvariables; SaLoader = new URLLoader(); SaLoader.dataFormat = URLLoaderDataFormat.TEXT; SaLoader.addEventListener(Event.COMPLETE,Asandler); // private methods function Asandler(event:Event):void{ // retrieve data from php call var resultString :String = event.target.data; // parse result string as json object and cast it to array var resultArray :Array = JSON.parse( resultString ) as Array; // get the length of the result set var len:int = resultArray.length; // create vector of SearchVO var searchVOs:Vector.&lt;searchVO1&gt; = new Vector.&lt;searchVO1&gt;(); // loop the result array for( var i:int = 0; i&lt;len; i++ ) { searchVOs[i] = new searchVO1(); searchVOs[i].nobed = resultArray[i].nobed; searchVOs[i].zip = resultArray[i].zip; searchVOs[i].Location = resultArray[i].Location; searchVOs[i].price = resultArray[i].price; } // call a function to create your boxes // or maybe create your SearchVector class and pass it your search vector var mySearchVector:SearchVectorTest = new SearchVectorTest(searchVOs); for( var i:int = 0; i&lt;len; i++ ) mySearchVector[i].nobed = searchVOs[i].nobed; mySearchVector[i].zip = searchVOs[i].zip; mySearchVector[i].Location = searchVOs[i].Location; mySearchVector[i].price = searchVOs[i].price; } } } public function searchVOs( nobed:String, zip:String, location:String, price:String ) { this.nobed = nobed; this.zip = zip; this.Location = Location; this.price = price; } public function ValidateAndsearch (event:MouseEvent):void { // validate fields Arvariables.nobed = s1.nobed.text; Arvariables.zip = s1.zip.text; Arvariables.Location = s1.Location.text; Arvariables.price = s1.price.text; SaLoader.load(SrSend); var s7:sresultnologin = new sresultnologin() removeChild(s1); addChild(s7); } } } </code></pre> <p>SearchVectorTest</p> <pre><code>package com.clark { import flash.display.MovieClip; import flash.text.TextField; import flash.text.TextFieldAutoSize; import flash.text.TextFormat; import flash.text.TextFormatAlign; import flash.display.Sprite; public class SearchVectorTest extends MovieClip { public function SearchVectorTest(test:Vector.&lt;searchVO1&gt;) { super(); for (var j:int = 0; j &lt; test.length; j++) { trace(test[j].nobed); trace(test[j].zip); trace(test[j].Location); trace(test[j].price); } var currentY:int = 270; for (var k:int = 0; k &lt; test.length; k++) { var Bolder:Listing5 = new Listing5(); Bolder.x=80; var bf:TextField = new TextField(); var bf1:TextField = new TextField(); var bf2:TextField = new TextField(); var bf3:TextField = new TextField(); bf3.width = 100; bf.defaultTextFormat = new TextFormat("Arial", 12, 0, null, null, null, null, null, TextFormatAlign.CENTER); bf.width = 100; bf.autoSize = TextFieldAutoSize.CENTER; bf1.width = 100; bf1.autoSize = TextFieldAutoSize.CENTER; bf2.autoSize = TextFieldAutoSize.CENTER; bf3.autoSize = TextFieldAutoSize.CENTER; bf3.width = 100; bf1.y= bf.height+5; bf.text = test[k].nobed; bf1.text = test[k].zip; bf2.text = test[k].Location; bf3.text = test[k].price; bf1.x = (Bolder.height-bf.height)*.5 bf3.x = (Bolder.height-bf.height)*.5 bf.x = (Bolder.height-bf.height)*.5 bf.y = (Bolder.height-bf.height)*.15 Bolder.addChild(bf); Bolder.addChild(bf1); Bolder.addChild(bf2); Bolder.addChild(bf3); Bolder.y = currentY; addChild(Bolder); currentY += Bolder.height + 35; } } } } </code></pre> <p>sresultnologin</p> <pre><code>package com.clark { import flash.display.*; import flash.events.Event; import flash.events.MouseEvent; import flash.display.Stage; import fl.controls.Button; public class sresultnologin extends MovieClip { public var s1:Searchreult = new Searchreult (); public function sresultnologin(){ // init addEventListener(Event.ADDED_TO_STAGE, onadded); function onadded (event:Event):void{ s1.x=-10; s1.y=10; addChild(s1); } var s3:SearchVectorTest= new SearchVectorTest(Vector.&lt;searchVO1&gt;); addChild (s3); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload