• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

ERROR 1034

Participant ,
Jul 16, 2012 Jul 16, 2012

Copy link to clipboard

Copied

HELLO ALL, I HAVE A QUESTION PLEASE HELP ME, I HAVE AN APPLICATION WHERE I HAVE A SPRITE CONTAINER WHERE I ADDCHILD MOVIE CLIPS WITH AN XML INFORMATION DATA LOADED, AND A SCROLLING MOUSE FUNCTION WITH A TWEEN EFFECTS. BUT WHEN I TESTED IT TURNS IN THE OUT THE NEXT ERROR "

Forced conversion error 1034, can not convert flash display :: Loader @ 29e80041 flash display.MovieClip

THANKS IN ADVANCE.

REGARDS

JOSELYN

TOPICS
ActionScript

Views

1.3K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 16, 2012 Jul 16, 2012

Copy link to clipboard

Copied

click file>publish settings>swf and tick "permit debugging".  retest.

copy and paste the error message and copy the problematic line of code mentioned in the error message.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 17, 2012 Jul 17, 2012

Copy link to clipboard

Copied

Hello Kglad

I send to you what you asking for, I click file>publish settings>swf and click "permit debugging".  and tested

it gave this error.

TypeError: Error #1034: Error de conversión forzada: no se puede convertir flash.display::Stage@edd3b51 en flash.display.MovieClip.
at prueba_fla::MainTimeline/frame1()[prueba_fla.MainTimeline::frame1:65]

THIS IS PART OF THE CODE


import com.greensock.TweenLite;

// CREATING NEWS ENTRIES

// news container for easier scrolling

var newsContainer:Sprite = new Sprite;
newsContainer.y = -newsContainer.height-stage.stageHeight/2;
addChild(newsContainer);

// storing references into array for later access
var newsArray:Array = new Array( );

// XML //

var MC2:MovieClip = MovieClip(this.parent); //
var newsHeight:Number=0;

// creating instances of NewsItem movieclips that will later be determined by XML
for(var k:Number=0;k<MC2.newsNum;k++) {

var newsItem:NewsItem = new NewsItem;

// XML INPUT

newsItem.title.text = MC2.newsTitle[MC2.newsNum-1-k];
newsItem.content.htmlText = MC2.newsContent[MC2.newsNum-1-k];
newsItem.info.text = MC2.newsInfo[MC2.newsNum-1-k];
newsItem.positionRule();

trace(newsItem.content.textHeight);
// positioning NewsItems moveiclips
// will later be determined by XML data
if(k>0) {
 
  newsItem.y = newsHeight;
 
}
newsArray.push(newsItem);
// adding newsItems as children to newsContainer
newsContainer.addChild(newsItem);
newsHeight += newsItem.content.textHeight+100;
trace(k + " " + newsHeight);
}


// VERTICLE MOUSE_MOVE SCROLLING

stage.addEventListener(MouseEvent.MOUSE_MOVE, scrollNews);

function scrollNews(evt:MouseEvent):void {

TweenLite.to(newsContainer, 0.3, { y:-(stage.mouseY/stage.stageHeight)*newsContainer.height+ newsHeight/2});
trace(-(stage.mouseY/stage.stageHeight)*newsContainer.height);
}

Thanks very much kglad

Regards

Joselyn

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 17, 2012 Jul 17, 2012

Copy link to clipboard

Copied

which is line 65?

and

var newsItem:NewsItem = new NewsItem;

should be

var newsItem:NewsItem = new NewsItem();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 20, 2012 Jul 20, 2012

Copy link to clipboard

Copied

Hi Kglad, Thank you for your answer, sincerelly this is  a part of a Example that I saw in the web, it loads a xml with a document class and a urlLoader class too in a mainContainer, it has a navigation of 4 buttons, I tried to separated this section because it likes to me, I was trying to do many intents to change the parameters but it doesn't works. I would like if you could tell me, if there is something wrong in the line 65 says "var MC2:MovieClip = MovieClip(this.parent);" .

I send to you the complete code,

THANKS AGAIN !! in advance for your great full.

TypeError: Error #1034: Error de conversión forzada: no se puede convertir flash.display::Stage@edd3b51 en flash.display.MovieClip.
at prueba_fla::MainTimeline/frame1()[prueba_fla.MainTimeline::frame1:65]

import flash.display.StageDisplayState;
import com.greensock.TweenLite;


// XML LISTS //
// ========= //


var newsTitle:XMLList;
var newsInfo:XMLList;
var newsContent:XMLList;

var newsTitleArray:Array;
var newsInfoArray:Array;
var newsContentArray:Array;

// number of items

var newsNum:Number;

// LOAD XML //
// ======== //

var xml:XMLLoader = new XMLLoader(this,"data.xml");

// function called when XML is loaded
function getXML(xmlData:XML):void {


newsTitle = xmlData.news.article.title;
newsInfo = xmlData.news.article.info;
newsContent = xmlData.news.article.content;

newsNum = newsTitle.length();
//trace(projectInfo);

newsTitleArray = xmlData.news.article.title.text().toXMLString().split("\n") ;
newsTitleArray.reverse();

newsInfoArray = xmlData.news.article.info.text().toXMLString().split("\n") ;
newsInfoArray.reverse();

newsContentArray = xmlData.news.article.content.text().toXMLString().split("\n") ;
newsContentArray.reverse();



}


// CREATING NEWS ENTRIES

// news container for easier scrolling
var newsContainer:Sprite = new Sprite;
newsContainer.y = -newsContainer.height-stage.stageHeight/2;
addChild(newsContainer);

// storing references into array for later access
var newsArray:Array = new Array( );

// XML //

var MC2:MovieClip = MovieClip(this.parent);
var newsHeight:Number=0;

// creating instances of NewsItem movieclips that will later be determined by XML
for(var k:Number=0;k<MC2.newsNum;k++) {

var newsItem:NewsItem = new NewsItem();

// XML INPUT

newsItem.title.text = MC2.newsTitle[MC2.newsNum-1-k];
newsItem.content.htmlText = MC2.newsContent[MC2.newsNum-1-k];
newsItem.info.text = MC2.newsInfo[MC2.newsNum-1-k];
newsItem.positionRule();

trace(newsItem.content.textHeight);
// positioning NewsItems moveiclips
// will later be determined by XML data
if(k>0) {
 
  newsItem.y = newsHeight;
 
}
newsArray.push(newsItem);
// adding newsItems as children to newsContainer
newsContainer.addChild(newsItem);
newsHeight += newsItem.content.textHeight+100;
trace(k + " " + newsHeight);
}


// VERTICLE MOUSE_MOVE SCROLLING

stage.addEventListener(MouseEvent.MOUSE_MOVE, scrollNews);

function scrollNews(evt:MouseEvent):void {

TweenLite.to(newsContainer, 0.3, { y:-(stage.mouseY/stage.stageHeight)*newsContainer.height+ newsHeight/2});
trace(-(stage.mouseY/stage.stageHeight)*newsContainer.height);
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 20, 2012 Jul 20, 2012

Copy link to clipboard

Copied

this.parent is the stage, not a movieclip.  use:


// XML LISTS //
// ========= //


var newsTitle:XMLList;
var newsInfo:XMLList;
var newsContent:XMLList;

var newsTitleArray:Array;
var newsInfoArray:Array;
var newsContentArray:Array;

// number of items

var newsNum:Number;

// LOAD XML //
// ======== //

var xml:XMLLoader = new XMLLoader(this,"data.xml");

// function called when XML is loaded
function getXML(xmlData:XML):void {


newsTitle = xmlData.news.article.title;
newsInfo = xmlData.news.article.info;
newsContent = xmlData.news.article.content;

newsNum = newsTitle.length();
//trace(projectInfo);

newsTitleArray = xmlData.news.article.title.text().toXMLString().split("\n") ;
newsTitleArray.reverse();

newsInfoArray = xmlData.news.article.info.text().toXMLString().split("\n") ;
newsInfoArray.reverse();

newsContentArray = xmlData.news.article.content.text().toXMLString().split("\n") ;
newsContentArray.reverse();



}


// CREATING NEWS ENTRIES

// news container for easier scrolling
var newsContainer:Sprite = new Sprite;
newsContainer.y = -newsContainer.height-stage.stageHeight/2;
addChild(newsContainer);

// storing references into array for later access
var newsArray:Array = new Array( );

// XML //

var MC2:MovieClip = MovieClip(this);
var newsHeight:Number=0;

// creating instances of NewsItem movieclips that will later be determined by XML
for(var k:Number=0;k<MC2.newsNum;k++) {

var newsItem:NewsItem = new NewsItem();

// XML INPUT

newsItem.title.text = MC2.newsTitle[MC2.newsNum-1-k];
newsItem.content.htmlText = MC2.newsContent[MC2.newsNum-1-k];
newsItem.info.text = MC2.newsInfo[MC2.newsNum-1-k];
newsItem.positionRule();

trace(newsItem.content.textHeight);
// positioning NewsItems moveiclips
// will later be determined by XML data
if(k>0) {
 
  newsItem.y = newsHeight;
 
}
newsArray.push(newsItem);
// adding newsItems as children to newsContainer
newsContainer.addChild(newsItem);
newsHeight += newsItem.content.textHeight+100;
trace(k + " " + newsHeight);
}


// VERTICLE MOUSE_MOVE SCROLLING

stage.addEventListener(MouseEvent.MOUSE_MOVE, scrollNews);

function scrollNews(evt:MouseEvent):void {

TweenLite.to(newsContainer, 0.3, { y:-(stage.mouseY/stage.stageHeight)*newsContainer.height+ newsHeight/2});
trace(-(stage.mouseY/stage.stageHeight)*newsContainer.height);
}

p.s.  please mark helpful/correct responses.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 23, 2012 Jul 23, 2012

Copy link to clipboard

Copied

LATEST

Hello kglad:

Thank you very much, i was trying to tested with this code and don't happening nothing,

now it doesn't gave me an error just appear a number 0 serveral times.

Do you believe that I can do it without this classes, load the xml in the movie clip created in

the library, and make the effects in the function "scrollNews",

I appreciate if you can gave me your advice.

Thanks again.

Joselyn

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines