• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 437
  • Last Modified:

How do I get the contents of a TileList box that is selected to appear in a MovieClip on the stage?

I currently have a TileList which is populated from an external XML file (works perfectly)

I have a MovieClip which uploads an external SWF into it (works perfectly)

The uploaded SWF has a MovieClip in it which i am using as a place holder for another image which gets uploaded and place inside it. (works perfectly)

I have added googles Drag and Drop code for TileList components to give it a nice play feel, however I wish to be able to drag an image off the TileList and onto this buried MovieClip.

I am completely at a lose on how to call the selecteditem from the tilelist as the code is all in an external as (class), I figured maybe if i can send a variable or trigger a function from the class to a function in the flash file... but nothing i do works.

Even if I can just drag the selecteditem to a non dynamically created movieclip on the stage and have it populate the movieclip on the stage I should be able to continue from there.
0
Gavyn_Elrick
Asked:
Gavyn_Elrick
  • 12
  • 7
1 Solution
 
blue-genieCommented:
Hi, I don't think you can actually drag an item out of a TileList.
are you not happy with simply if the user clicks on one of those images in the TileList, that image gets loaded into the clip in quesiton?
0
 
Gavyn_ElrickAuthor Commented:
that would be great if i could get that working i could change it to work with the drag and drop... and you should look up... wait i will send you the link

http://code.google.com/p/as3-drag-and-drop-tilelist/

thats for tilelist drag and drop.

But if you can help me with the click i would be greatful either way
0
 
Gavyn_ElrickAuthor Commented:
I have also seen my idea already used sadly... so i know you can do what i am trying to accomplish. I can send you the link as well for that if you'd like to check it out.

P.S. I find with EE it takes forever to solve a problem cause maybe online one message gets replied too a day... is there a time maybe this weekend if possible I can connect online with you... or someone... and throw some ideas against the wall, if anyone has an interest in solving this of course.

Figure I am missing something simple or over looking something... TileList's are the bane of my existence.

I know also that EE would like us to show how we worked out our solution to help others. Well I would be glad to document how we accomplished and add it to this blog for others. But just to speed things up I would like to take it off EE and onto a faster form of communication.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
blue-genieCommented:
i have no idea how to do the drag and drop with a tile list.
will give it a try and if i find a solution will let you know.
in terms of the other option, simply use an eventlistener to get the clicked on item

off the top of my head the syntax looks something like this (confirm in help file)
tilelist.addEventListener(MouseEvent.Click, blah);
function blah(e:Event) {
trace(e.target.content.selectedItem.label);//or whatever you called it to set the tilelist items.
//use that value to load the selected image into your required target
}


0
 
Gavyn_ElrickAuthor Commented:
well ya i know how to use eventlisteners they are swarming through out my program.

but the selectedItem function doesn't work if its not in a class... and if its in a class i can not seem to be able to call the movieclip on the stage. Cause it was created outside the class.
0
 
Gavyn_ElrickAuthor Commented:
p.s.

tilelist.addEventListener(MouseEvent.Click, blah);

is actually

tilelist.addEventListener(MouseEvent.CLICK, blah);

it has to be capitalized
0
 
Gavyn_ElrickAuthor Commented:
here is the error your code gives me

ReferenceError: Error #1069: Property content not found on fl.controls.listClasses.ImageCell and there is no default value.

which is the same thing when i used it with out content

trace(e.target.selectedItem.label);

ReferenceError: Error #1069: Property selectedItem not found on fl.controls.listClasses.ImageCell and there is no default value.

so ya thats were i am at your almost catching up...

i believe...

e.target.selectedItem.label

can only be called or used inside the class... which as i mentioned... if i do that and then try and even do a call to

trace(stage.castingImage);

which is the name of the movieclip on the stage...

it errors

1119: Access of possibly undefined property castingImage through a reference with static type flash.display:Stage.

were to go from here
0
 
Gavyn_ElrickAuthor Commented:
I'm sorry that was wrong of me

trace(stage.castingImage);  isn't corrent

trace(castingImage);   is...

outside the Class... in the FLA.. this is what trace's

[object castingImage_mc_18]

inside the Class of the Tilelist... this is what trace's

1120: Access of undefined property castingImage.

so i am not sure how i can call the movieclip cause the name...

tilelist.selectedItem.label

only works in the class and

i can only call the movieclip (castingImage) in the FLA...

*head is spinning i mustn't be doing something right
0
 
blue-genieCommented:
i did mine in a simple unnamed package.

whichever class you created your tileList in, that's where you're doign the event listener and getting the image selected yes.
and you should only be listening after your tilelist is populated in order for there not to be the dreaded null reference error.
what is castingImage?

how big are all your packages, zip it up if you can lets have a look.
0
 
Gavyn_ElrickAuthor Commented:
sounds good let me get onto it i need to trim it abit will take me a bit and i will have it upload for you to check out.

Thank you!
0
 
Gavyn_ElrickAuthor Commented:
Files that need renaming

castingImage.txt    =    castingImage.swf
dd_tile_list.txt        =    dd_tile_list.as
example.txt           =    example.xml
tilelist.txt                =    tilelist.fla


and all should work as intended so far.

Thanks again for taking a look at this
example-tilelist.zip
0
 
blue-genieCommented:
ok i've downloaded everything but so far i'm not getting any compile or run time errors though the file is flashing like crazy.
will have a look through the day and get back to you.
0
 
blue-genieCommented:
i'm missing something. tileList don't load.
0
 
Gavyn_ElrickAuthor Commented:
let me review it i am very sorry thought it worked out on my end might have missed something
0
 
Gavyn_ElrickAuthor Commented:
hmmm well it runs on my end i will rezi pand upload again... remember you have to have all the renamed files renamed back to the .as .fla .swf .xml that there were ment to be...

lets give it another shot

there are three of the renaming files in the first directory... the last one is buried in the com/jeremyrodgers directory

tilelist-example.zip
0
 
blue-genieCommented:
cool working now the previous one didn't have anything in the com/jeremyrodger dir.
i'm on it.will let you know.
0
 
blue-genieCommented:
the drag and drop thing needs to be looked at when i'm a bit more awake.
doing a normal  click and release  i can pull the contents of the item i clicked on.

i.e. images/f13.jpg

but i can't get this to trigger when i stop dragging, so maybe my event listener is conflicting with one of the other ones.
i also can't pull your castingImage movieclip off the stage. Maybe because its not a class that extends a displayObject. and you don't have a document class.
not sure.
when doing the hit test to see if the object was dropped onto the clip i keep getting this. does it mean anything to you?
[object castingImage_mc_1]

so when i drag it anywhere on the stage returns me a true - anywhere off the blue area, returns false.

will look at this drag and drop thing a little closer.
0
 
Gavyn_ElrickAuthor Commented:
In reply:

i also can't pull your castingImage movieclip off the stage. Maybe because its not a class that extends a displayObject. and you don't have a document class.

-- I dont understand what your trying to do with this one. The castingImage movieclip is just there to load the external clip into... its sort of a casting couch for those members i wish to change. Its main purpose is to show like i said who customizable members, and you drag an image from the tilelist onto the castingimage which in the end will replace that image then i send that info to my server to save. Which the sending info to the server i have covered... the program is much bigger then this one little file i just removed the rest as it isn't important to my problem at hand.

when doing the hit test to see if the object was dropped onto the clip i keep getting this. does it mean anything to you?

[object castingImage_mc_1]

-- this is a trace(castingImage); statement to show i have mouse_over the buttom right head... all heads are suppose to have this but thats a simple copy and paste once i get this working right.

so when i drag it anywhere on the stage returns me a true - anywhere off the blue area, returns false.

will look at this drag and drop thing a little closer.

thanks again for sticking with me
0
 
Gavyn_ElrickAuthor Commented:
*taps foot

no worries... figured it out myself got it all working just the way i want it!!

I had a class i already had made that creates its own customevents and if i called that in the class file then in the main file i can do a eventlisten for when that customevent triggers and use this to pass info back to the main file and away i go
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 12
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now