public var aaa:Sprite = new Sprite();
とかして、何も内部に入れないままで、height、widthを設定すると、height=0,width=0とかになるんだけど、その後graphicとかで内部に何か配置しても表示されなかったりする。
なんかイマイチ仕様が良くわかってないけど、変数定義で初期化している場合にはこれ気をつけよう。
3時間も無駄にしてしまった・・・。
public var aaa:Sprite = new Sprite();
とかして、何も内部に入れないままで、height、widthを設定すると、height=0,width=0とかになるんだけど、その後graphicとかで内部に何か配置しても表示されなかったりする。
なんかイマイチ仕様が良くわかってないけど、変数定義で初期化している場合にはこれ気をつけよう。
3時間も無駄にしてしまった・・・。
We use cookies to improve your experience on our site. By using our site, you consent to cookies.
Manage your cookie preferences below:
Essential cookies enable basic functions and are necessary for the proper function of the website.
These cookies are needed for adding comments on this website.
Google reCAPTCHA helps protect websites from spam and abuse by verifying user interactions through challenges.
Google Tag Manager simplifies the management of marketing tags on your website without code changes.
Statistics cookies collect information anonymously. This information helps us understand how visitors use our website.
Google Analytics is a powerful tool that tracks and analyzes website traffic for informed marketing decisions.
Service URL: policies.google.com (opens in a new window)
Marketing cookies are used to follow visitors to websites. The intention is to show ads that are relevant and engaging to the individual user.
A video-sharing platform for users to upload, view, and share videos across various genres and topics.
Service URL: www.youtube.com (opens in a new window)
You can find more information in our Cookie Policy and Privacy policy.
「メモ」への4件の返信
僕もそのへんよくミスります……。画像読み込み完了前にリサイズ指定してたりして、あああ〜、みたいのとか。(;´∀`)
なんか目に見えなくなるから、なんかほかの問題なのかと思っていつも最後の最後に気づいて時間を無駄にしてしまう・・・。もうまず最初にこれから確認だ!
内部的には実質、値を scaleX, scaleYで管理しているんじゃないいかと思います。
heighを設定する→ height から scaleを計算というプロセスで、画像がないので height が0になり、計算されたscaleが0になり、scale0なので以後なにも表示されない・・・ という感じなのではないでしょうか。
そうだと思います。この問題が発生するのは、サイズの未定の外部イメージを読み込んでサイズ指定で配置したいときとかが多いですね。
稀にwidthがマイナスになっていたりと意味不明な結果になっているときもあります。(どういう理屈なのか・・)