dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: image won't load

  1. #1
    Junior Member
    Join Date
    Jan 2008
    Posts
    28

    image won't load

    Hello,
    I have a scroll panel with thumbnails, when a thumbnail is clicked, the corresponding video is loaded in the player, and another image should appear beside it. I made a list in xml containing the thumbnails, videos, and the images.
    When i click on a thumbnail, the proper video loads but the image does not and i get this the following error:

    (TypeError: Error #1034: Type Coercion failed: cannot convert "image" to flash.net.URLRequest.
    at imaktion12_fla::MainTimeline/playOnClick()
    at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunctio n()
    at flash.events::EventDispatcher/dispatchEvent()
    at com.afcomponents.common::ItemData/setEvent()
    at com.afcomponents.common::AfImage/com.afcomponents.common::dataEvent(),

    Here is part of my xml code:
    <content>
    <item>
    <description>image</description>
    <path>thumbnail</path>
    <data>video</data>
    <type></type>
    </item>


    Here is my AS:

    import fl.video.VideoEvent;
    import flash.events.MouseEvent;
    import com.afcomponents.scrollpanel.ScrollPanelEvent;

    function loadComplete(event:ScrollPanelEvent){
    myScroll.addGenericItemEventListener(MouseEvent.CL ICK, playOnClick);
    video1.source = myScroll.getSelectedItem().data;
    imageLoader.source = myScroll.getSelectedItem().description;
    }
    myScroll.addEventListener(ScrollPanelEvent.XML_LOA D_COMPLETE, loadComplete);

    function playOnClick(event:MouseEvent) {
    video1.source = event.target.data;
    var imageLoader:Loader = new Loader();
    imageLoader.load(event.target.description);
    addChild(imageLoader);
    imageLoader.y = 160;
    imageLoader.x = 22;
    }


    function nextMovie(event:VideoEvent) {
    myScroll.selectNextItem();
    video1.source = myScroll.getSelectedItem().data;
    }
    video1.addEventListener(VideoEvent.COMPLETE, nextMovie);

    thanks

  2. #2
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Try this:

    import flash.net.URLRequest;

    imageLoader.source = new URLRequest(myScroll.getSelectedItem().description) ;
    Last edited by cancerinform; 01-11-2008 at 01:03 PM.
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

  3. #3
    Bearded (M|G)od MyFriendIsATaco's Avatar
    Join Date
    Dec 2002
    Location
    Awesomeville.
    Posts
    3,046
    It looks more than likely like your problem lies here:

    imageLoader.load(event.target.description);

    Change that to:

    imageLoader.load(new URLRequest(event.target.description));

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center